REPT Function Excel

If you just need to rept function excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =REPT(text, number_times) — it repeats a string n times, which is how you build an in-cell bar chart with no chart object at all.

On this page8

Syntax

=REPT(text, number_times)

Arguments

Argumentrequired / optionalDescription
textrequiredThe text to repeat.
number_timesrequiredHow many repetitions. Decimals are truncated; 0 returns an empty string.

Related functions

LENCONCATENATECHAR and CODE
▤Annotated stepsExcel
1

Pick a repeating character — █ for a solid bar, | for a lighter one, ★ for a rating.

2

Type =REPT( and enter it in quotes, then a comma.

3

Enter the count, scaling it against the column maximum so the longest bar fits the cell.

4

Set the cell font to a monospace face so every bar is the same width per unit.

Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

REPT repeats text a given number of times. Its best-known use is the in-cell bar chart: repeating a block character in proportion to a value produces a sparkline-style bar that lives in the cell, sorts with the data and needs no chart object. It is also how you pad values to a fixed width for a legacy fixed-format export. Decimals in the count are truncated, and a count of 0 returns an empty string rather than an error, which makes it safe on zero-valued rows. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. Treat “rept function excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected formula shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a calculation you can defend to a CFO or an auditor into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

An in-cell bar chart scaled to a maximum of 100: =REPT("█", ROUND(B2/MAX($B$2:$B$50)*20, 0)) draws up to twenty blocks. A star rating from a score: =REPT("★", B2) & REPT("☆", 5-B2). Left-padding an ID to eight characters: =REPT("0", 8-LEN(A2)) & A2. REPT gives you a chart that lives inside the cell, sorts with the data and survives being pasted anywhere — which no chart object does. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. For “rept function excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Not scaling against the maximum, so a large value produces a bar hundreds of characters long.
  • Leaving the cell in a proportional font, which makes bars of equal length look unequal.
  • Exceeding the 32,767-character cell limit, which returns #VALUE!.

Frequently asked questions

How do I make an in-cell bar chart?

=REPT("█", value/MAX(range)*20) scales the bar to at most twenty characters. Use a monospace font for even widths.

How do I pad a value to a fixed length?

=REPT("0", target_length-LEN(A2)) & A2 left-pads with zeros.

What happens with a count of zero?

It returns an empty string, which makes it safe to use on rows whose value is zero.