REPT Function

Repeats text a given number of times.

Category

Text

Available in

All versions, Microsoft 365

Returns

Text

Want to practice REPT in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox

Overview

REPT repeats a character or piece of text as many times as you ask.

It's handy for quick in-cell bar charts, padding codes to a fixed length, and visual star ratings.

Syntax

=REPT(text, number_times) Explain

Arguments

ArgumentRequired?What it does
textYesThe text to repeat.
number_timesYesHow many times. Decimals are truncated; 0 returns empty text.

Examples

Example 1 — An in-cell bar chart

One block for every 100 in sales.

C2fx=REPT("■", ROUND(B2/100, 0))
ABC
1RegionSalesChart
2West620■■■■■■
3East480■■■■■
4North250■■■
=REPT("■", ROUND(B2/100, 0)) Explain

Example 2 — Star ratings

Show a 1–5 rating as stars.

=REPT("★", B2)&REPT("☆", 5-B2) Explain

Example 3 — Padding with zeros

Pad an ID to six characters.

=REPT("0", 6-LEN(A2))&A2 Explain

Common mistakes

  • Negative counts. A negative number_times returns #VALUE!. Guard with MAX(0, …).

Notes

Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.