How to Use the REPT Function to Create In-Cell Bar Charts in Excel

When most people need to visualize data in Microsoft Excel, they immediately highlight their numbers and click “Insert Bar Chart.” However, massive, floating charts can severely clutter a spreadsheet and obscure your underlying data. If you simply want to create a fast, clean visual indicator directly inside a tiny cell, you can use a brilliant workaround involving the REPT() function.

How the REPT Function Works

The REPT() (Repeat) function is a simple text manipulation tool. It asks for a specific character, and a specific number, and then it repeats that character that exact number of times.

For example: =REPT("A", 5) will instantly output AAAAA.

We can exploit this mathematical repetition to generate a crude, highly effective bar chart by using the “Pipe” character ( | ), which is located directly above the Enter key on most keyboards.

Step-by-Step Instructions

  1. Open your Excel spreadsheet.
  2. Suppose cell A1 contains a sales figure of 45, and cell A2 contains a sales figure of 12.
  3. Click on the empty cell directly next to the first number (cell B1).
  4. Type the following formula:

=REPT("|", A1)

  1. Press Enter.

Formatting the Output into a Chart

Cell B1 will instantly output 45 individual pipe characters tightly packed together: |||||||||||||||||||||||||||||||||||||||||||||

To transform this ugly string of text into a beautiful, solid bar, you simply need to change the font.

  1. Highlight cell B1.
  2. Go to the Home tab and change the font from standard Calibri or Arial to a thick, blocky font like Playbill or Stencil. (Alternatively, you can change the font color to bright red or green).
  3. Use the fill handle (the small green square at the bottom right) to drag the formula down to B2.

The result is a stunning, perfectly scaled bar chart sitting cleanly inside your individual cells. Because it is powered by a formula, if the sales figure in A1 suddenly drops from 45 to 10, the bar chart in B1 will instantly shrink to match, providing a flawless, space-saving visual dashboard.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.