Practice free

REPT function

REPT repeats text a set number of times and returns the result. It is used for quick in-cell bar charts or for padding values with leading characters, up to 32,767 characters.

Example

Read it as a sentence: repeat ab three times in a row, which gives ababab.

Practice this in the app

Syntax

REPT(text, number_times)

text (required)
The text to repeat.
number_times (required)
How many times to repeat it.

Returns: The repeated text.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=REPT("ab",3) ababab Basic
=REPT("ab",0) Zero
=REPT("ab",2.9) abab Fractional
=LEN(REPT("a",32767)) 32767 Max length
=REPT(1,3) 111 Number text
=REPT("-",{1,2}) - Array spills
=REPT("ab",-1) #VALUE! Negative
=REPT("a",32768) #VALUE! Over max

Watch out for

  • Result is capped at 32,767 characters.
  • A negative count gives #VALUE!.

Where it works

Excel
REPT is in every version of Excel from 2007 on.
Google Sheets
Same name, same behaviour for everyday use.

Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .