Lesson 33 of 49
Formulas for In-Cell Visuals: The REPT Function KPI Meters
Overview & Learning Objectives
The REPT function repeats any text character a specified number of times. By repeating block characters like "█" or "|", you can build lightweight, customizable in-cell KPI progress meters and star ratings that never slow down Excel.
- Master the REPT function: `=REPT(text, number_times)`.
- Construct text progress bars using the solid block character "█".
- Generate visual 5-star customer ratings () dynamically from raw decimal scores.
Industry Standard
Standard: Financial analysts use formula-based REPT bars inside text exports and PDFs where graphic charts and heavy conditional formatting are unsupported.
Real-World Example: Sales Target Achievement Progress Bars
Your sales team has monthly target achievements ranging from 20% to 100%. Using `=REPT("█", Achievement*20)` creates a progress meter directly inside the cell, scaling proportionally with performance.
| Sales Rep | Target Achieved % | Formula Used | In-Cell Visual Bar |
|---|---|---|---|
| Vikram | 90% | =REPT("█", B2*10) | █████████ (9/10) |
| Ananya | 70% | =REPT("█", B3*10) | ███████ (7/10) |
| Rahul | 100% | =REPT("█", B4*10) | ██████████ (10/10) |
| Pooja | 40% | =REPT("█", B5*10) | ████ (4/10) |
REPT Progress Bar Syntax
=REPT("█", ROUND(Achievement_Percentage * 10, 0))
=REPT("", Rating) & REPT("", 5 - Rating)
Parameters Breakdown
text: The character to repeat (e.g. "█", "|", "").number_times: Integer count. Must be >= 0. Decimal inputs are automatically truncated.
Sample Walkthrough (Q&A):
Question: How do you create a dynamic 5-star rating display from a rating of 4 in cell B2?
Formula / Action: `=REPT("", B2) & REPT("", 5 - B2)`
Result: ""
Explanation: Repeats filled star 4 times and hollow star 1 time, creating an exact 5-star rating widget.
Common Mistakes & Limitations
- Passing negative numbers to REPT, which causes an immediate `#VALUE!` error. Shield with `MAX(0, count)`.
- Forgetting to multiply percentages by a scaling factor (e.g. `90%` is `0.9`, so `=REPT("█", 0.9)` prints 0 blocks!). Multiply by 10 or 20.
Keyboard Shortcuts
| Action | Windows | Mac |
|---|---|---|
| Insert Character "█" | Alt + 219 on numeric keypad | Character Viewer |
| Change Font Color of Bar | Alt + H + F + C | Home Ribbon |
Pro Tips & Modern Alternatives
- Format the cell with the "Playbill" or "Stencil" font with character "|" to create an unbroken solid bar.
- Combine REPT with IF to turn underperforming bars red using conditional formatting font color.