REPT Function Excel

“rept function excel” comes up constantly, so this page leads with the exact answer, and only then explains the detail. Everything works in Excel on Windows and Mac and maps almost one-to-one to Google Sheets. Copy the answer above and get back to work, or read on to turn a one-off fix into something you never have to look up again.

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

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

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. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. 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. If you take one thing from this page on “rept function excel”, make it the habit rather than the keystrokes: set the problem up with labelled inputs, reference those cells, and let Excel do the recomputing. Bookmark the page for the syntax, but do the example once in a blank sheet and check it against the tool above — five minutes of hands-on practice fixes the method in memory far better than re-reading, and it surfaces the small snags while they are still harmless. After that the technique is genuinely yours: faster than searching for it again, and reliable enough to drop into work that other people depend on.

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.