ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Text
  3. REPT in Excel: Simple In-Cell Bar Charts

REPT in Excel: Simple In-Cell Bar Charts

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

REPT repeats text a number of times: =REPT("|",5) returns |||||. To draw an in-cell bar chart, repeat a character in proportion to each value, such as =REPT("|",B2/1000) for one bar per 1,000. Scale long bars with =REPT("|",ROUND(B2/MAX($B$2:$B$7)*20,0)) so the largest value gets 20 characters.

Key takeaways

  • =REPT(text, number_times) repeats text; decimals in number_times are cut off, not rounded.
  • Divide the value by a step (like 1000) or scale it against MAX to keep bars a sensible length.
  • Join two REPTs with & for progress bars: filled characters, then empty ones.
  • A narrow character such as | gives smooth bars; set the font colour to style them.
  • Conditional Formatting Data Bars are the built-in alternative when you don't need text.
On this page+
  1. What does the Excel REPT function do?
  2. How to make an in-cell bar chart with REPT
  3. How to scale bars to a fixed width
  4. How to show the number next to the bar
  5. How to build a progress bar
  6. Other uses: star ratings and padding
  7. REPT vs Conditional Formatting Data Bars
  8. Common REPT mistakes
  9. Practise it

The Excel REPT function repeats a piece of text a set number of times, and that simple job makes it a quick way to draw bar charts inside cells. =REPT("|",B2/1000) turns a sales figure into a row of bars you can read at a glance. This guide is for anyone who wants a visual summary in a table, a progress tracker or a report without building a chart.

What does the Excel REPT function do?#

REPT returns text repeated as many times as you say.

Excel formula
=REPT(text, number_times)
FormulaResult
=REPT("ab",3)ababab
=REPT("|",5)|||||
=REPT("★",4)★★★★
=REPT("|",3.9)|||
=REPT("|",0)(empty text)

Two rules to remember:

  • Decimals are cut off. REPT keeps only the whole number part of number_times, so 3.9 gives 3 repeats. Use ROUND when you want 3.9 to count as 4.
  • The result is text. It lines up with the rest of the row, but you can't add it up.

REPT works in every version of Excel, including Excel for Mac and Excel for the web.

How to make an in-cell bar chart with REPT#

Repeat a narrow character once for every step of the value. Here are five reps' sales:

ABC
1RepSalesBar
2Ava12,000||||||||||||
3Ben18,500||||||||||||||||||
4Cara7,400|||||||

In C2, type:

Excel formula
=REPT("|",B2/1000)

Each 1,000 in sales adds one bar. 12,000 gives 12 bars, and 18,500 gives 18 (the half is dropped). Fill down with Ctrl+D on Windows or ⌘D on a Mac, and the column becomes a simple horizontal bar chart.

Make the bars look better#

A few formatting tweaks make a big difference:

  • Set the font colour of column C to a strong colour, such as blue or green.
  • Left-align the column so all bars start at the same edge.
  • Try other characters. A full block (█) gives solid bars; in Excel 2013 and later you can produce it with =REPT(UNICHAR(9608),B2/1000).
  • Shrink the font size of the bar column if the bars get too long.

How to scale bars to a fixed width#

Divide each value by the largest one to keep the longest bar at a set length, however big the numbers are:

Excel formula
=REPT("|",ROUND(B2/MAX($B$2:$B$6)*20,0))

How it works:

  1. B2/MAX($B$2:$B$6) gives each value as a share of the largest, from 0 to 1.
  2. *20 makes the largest value 20 characters long.
  3. ROUND turns the share into a whole number of bars.

For Ben, 18,500 ÷ 21,000 × 20 is 17.6, which rounds to 18 bars, while Dev, the top seller, gets the full 20. Lock the range with dollar signs before filling down, so every row compares against the same maximum. This version keeps working when sales grow from thousands to millions, while the /1000 version would start drawing hundreds of bars.

How to show the number next to the bar#

Join the bar and the value with &. The joining text guide covers & in detail.

Excel formula
=REPT("|",B2/1000)&" "&TEXT(B2,"#,##0")

For Ava, this shows 12 bars followed by 12,000. TEXT formats the number with a thousands separator, because joining a raw number would show 12000.

How to build a progress bar#

Join two REPTs: one for the completed part and one for the rest. With a percentage complete in B2 (for example 0.3 for 30%):

Excel formula
=REPT("■",ROUND(B2*10,0))&REPT("□",10-ROUND(B2*10,0))

At 30%, this returns ■■■□□□□□□□: three filled squares and seven empty ones, always 10 in total. It works well in project trackers and task lists. Add &" "&TEXT(B2,"0%") to show the percentage after the bar.

Other uses: star ratings and padding#

REPT is useful wherever you need repeated characters:

TaskFormulaResult for 4
Star rating out of 5=REPT("★",B2)&REPT("☆",5-B2)★★★★☆
Leading zeros to 6 digits=REPT("0",6-LEN(B2))&B2000004
Dot leaders in a list=A2&REPT(".",20-LEN(A2))name followed by dots

For leading zeros, =TEXT(B2,"000000") gives the same result and is easier to read; REPT is handy when the value is already text. REPT also pairs well with REPLACE to hide part of an ID, as shown in our guide to SUBSTITUTE and REPLACE.

REPT vs Conditional Formatting Data Bars#

Excel has a built-in way to draw bars inside cells. Select the numbers, then choose Home > Conditional Formatting > Data Bars and pick a style. The bar appears behind the number in the same cell.

REPT barsData Bars
Needs a formulaYesNo
Bar in a separate cellYesNo, behind the number
Combine with textYes, with &No
Smooth, exact lengthsNo, whole charactersYes
Works in every versionYesYes (Excel 2007 and later)

Use Data Bars for a polished report. Use REPT when you want the bar in its own column, need to join it with text, or want a trick that also works in a plain-text export.

Common REPT mistakes#

These are the problems people run into:

  • Bars that run off the screen. The values are too big. Divide by a larger step or scale with MAX.
  • #VALUE! In Excel, a negative number_times or a result over 32,767 characters returns #VALUE!. Check for negative values or wrap them in MAX(0, …).
  • Uneven bars. Proportional fonts make some characters wider. Use the same character in every row.
  • Forgetting the quotes. The text to repeat must be in double quotes: "|".

If you want to split text apart rather than build it up, TEXTSPLIT splits a cell into columns, and LEFT, RIGHT and MID take out part of a cell.

Practise it#

Try the bar chart exercise on this page. Then open the joining text lesson to practise &, CONCAT and TEXTJOIN in a live spreadsheet; the TEXTJOIN function guide explains its delimiter and ignore_empty options, and CONCATENATE vs CONCAT vs TEXTJOIN helps you pick the right one.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Draw a bar for each rep's sales: one | for every 1,000. In C2, use REPT to repeat "|" B2/1000 times.

fx
ABCD
1
Rep
Sales
Bar
2
Ava
12000
3
Ben
18500
4
Cara
7400
5
Dev
21000
6
Ella
15200
7
8
9

Tip: REPT takes the text to repeat in double quotes, then how many times. Here that is B2 divided by 1000.

Practise this in a lesson

LessonJoining text: &, CONCAT and TEXTJOINBuild full names, addresses and tag lists by joining text with &, CONCAT and TEXTJOIN.Function guideTEXTJOINJoin cells with commas, spaces or semicolons using TEXTJOIN, and skip blanks automatically. Examples, pitfalls and a live exercise.

Frequently asked questions

What does REPT do in Excel?

+

REPT repeats a piece of text a given number of times. =REPT("ab",3) returns ababab. It works in every version of Excel.

What happens if number_times is a decimal?

+

REPT drops the decimal part, so =REPT("|",3.9) returns three bars, not four. Wrap the number in ROUND if you want normal rounding.

How do I make an in-cell bar chart without REPT?

+

Select the numbers and choose Home > Conditional Formatting > Data Bars. Excel draws a bar inside each cell behind the number, with no formula.

Why does REPT return #VALUE!?

+

In Excel, REPT returns #VALUE! when number_times is negative or the result would be longer than 32,767 characters. Check the value you repeat by and scale it down.

Sources

  • REPT function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What does the Excel REPT function do?
  2. How to make an in-cell bar chart with REPT
  3. How to scale bars to a fixed width
  4. How to show the number next to the bar
  5. How to build a progress bar
  6. Other uses: star ratings and padding
  7. REPT vs Conditional Formatting Data Bars
  8. Common REPT mistakes
  9. Practise it

Keep reading

Text· 8 min read

SUBSTITUTE and REPLACE in Excel

Use SUBSTITUTE when you know the text you want to change: =SUBSTITUTE(A2,".","-") swaps every dot for a dash. Use REPLACE when you know the position: =REPLACE(A2,1,3,"XXX") overwrites the first three characters. SUBSTITUTE is case-sensitive and can change just one occurrence; REPLACE ignores what the characters say.

Text· 7 min read

TEXTSPLIT in Excel: Split Text Into Columns

TEXTSPLIT splits one cell into several cells at a delimiter you choose. =TEXTSPLIT(A2,",") puts each comma-separated item in its own column, spilling to the right. Add a row delimiter to split into rows as well, and TRUE as the fourth argument to skip empty items. TEXTSPLIT needs Microsoft 365, Excel 2024 or Excel for the web.

Text· 7 min read

How to Combine Text in Excel (&, CONCAT, TEXTJOIN)

To combine text in Excel, join the pieces with &: =A2&" "&B2 turns Nora and Delgado into Nora Delgado. CONCAT does the same with a list of pieces. TEXTJOIN puts the same separator between every piece and can skip empty cells: =TEXTJOIN(", ",TRUE,C2:E2). Type spaces and commas yourself, inside double quotes.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free