Text

REPT Function in Excel

Repeats text a specified number of times.

Syntax

  • =REPT(text, number_times)

Arguments

  • text (required): Text to repeat
  • number_times (required): Number of repetitions

Examples

  • =REPT("*", 5) - Repeat asterisk 5 times - Result: *****
  • =REPT("-=", 10) - Create pattern - Result: -=-=-=-=-=-=-=-=-=-=

Excel REPT function documentation

  • REPT repeats text a given number of times.
  • Syntax: =REPT(text, number_times). Builds padding, bar charts from characters, and indent markers.
  • Legacy but still useful for visual sparkline-style bars using pipe or block characters.
  • Related: [TEXT](/functions/text/), [LEN](/functions/len/), [CONCATENATE](/functions/concatenate/).

REPT syntax and limits

  • text: character or string to repeat — often "|" or "█" for bars.
  • number_times: non-negative integer; decimals truncate.
  • Result max string length 32,767 characters — cap number_times on long base strings.
  • number_times=0 returns empty string.

Step-by-step: in-cell bar chart

  • Step 1 — Values 0–100 in column B.
  • Step 2 — =REPT("|", ROUND(B2/5, 0)) for 20-char max bar.
  • Step 3 — Widen column and use monospace-friendly font.
  • Step 4 — Compare with Excel sparklines for production dashboards.
  • Step 5 — Combine with [LEN](/functions/len/) to validate bar length.

REPT vs SPARKLINE vs REPEAT in 365

  • REPT — character repetition; universal Excel.
  • Sparklines — native mini charts.
  • Conditional format data bars — no formula column.
  • Text category: [/categories/text/](/categories/text/).

Worked examples to copy

  • Dashes: =REPT("-", 10).
  • Pad zeros visually: =REPT("0", 4-LEN(A2))&A2.
  • Stars rating: =REPT("★", B2).
  • Indent: =REPT(" ", level)&text.

People also ask

  • REPT #VALUE!? — number_times negative or text not valid.
  • REPT slow? — Huge number_times can bloat workbook.
  • REPT vs TEXT padding? — REPT simpler for repeated char.
  • REPT Unicode blocks? — Yes if font supports character.

Common errors

  • Result cannot exceed 32,767 characters

Use cases

  • Visual indicators
  • Progress bars
  • Padding strings

Frequently asked questions

  • How do I create a simple bar chart in a cell using REPT? Use =REPT("|", A1/10) or =REPT("█", A1) to create a bar proportional to the value. For a 0-100 scale with 10 bars max: =REPT("█", ROUND(A1/10, 0)). Adjust the divisor to control bar length.
  • How do I pad a number with leading zeros using REPT? Use =REPT("0", 5-LEN(A1))&A1 to pad to 5 digits. For value 42, this creates "00042". Or use TEXT: =TEXT(A1, "00000") is simpler for numeric padding.
  • Can I use REPT to create a rating display with stars? Yes! =REPT("★", A1)&REPT("☆", 5-A1) shows filled and empty stars for a 1-5 rating. If A1=3, result is "★★★☆☆". Use UNICHAR(9733) for ★ and UNICHAR(9734) for ☆ if needed.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.

When to use REPT

  • Visual indicators — common Text scenario for REPT.
  • Progress bars — common Text scenario for REPT.
  • Padding strings — common Text scenario for REPT.

REPT in the Text category

  • Browse all Text functions at /categories/text/ for related formulas.
  • REPT syntax: =REPT(text, number_times)
  • text (required): Text to repeat
  • number_times (required): Number of repetitions
  • Confirm REPT arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.

Formula checklist before you copy down

  • Confirm REPT arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.
  • If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
  • Spot-check three known input rows manually against expected output.

Related Excel functions

  • CONCAT (/functions/concat/): Joins two or more text strings into one string.
  • TEXTJOIN (/functions/textjoin/): Joins text from multiple ranges with a delimiter, with option to ignore empty cells.

Errors to watch for

  • Result cannot exceed 32,767 characters — review causes on linked error pages in the directory.

Copy-paste audit workflow

  • Enter REPT on three test rows with known expected output documented on a QA tab.
  • Fill down only after absolute references are locked on lookup tables and rate tables.
  • Compare against manual calculation or a calculator for financial and statistical functions.
  • Search this directory for comparison guides when choosing between similar functions in the same category.

REPT worked examples to copy

  • =REPT("*", 5) — Repeat asterisk 5 times. Expected result: *****.
  • =REPT("-=", 10) — Create pattern. Expected result: -=-=-=-=-=-=-=-=-=-=.

REPT reference summary for crawlers and offline review

  • REPT belongs to the Text category in Excel. Repeats text a specified number of times.
  • Full syntax: =REPT(text, number_times). Open /functions/rept/ for parameters, FAQs, and related pages.
  • Common mistakes: Result cannot exceed 32,767 characters
  • Pair this function with comparison guides when another Excel formula might fit the same task better.
  • Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.