Locked lesson.
About this lesson
Create in-cell visualizations using the REPT function.
Exercise files
Download this lesson’s related exercise files.
07-07-The REPT Function-Start.xlsx12.6 KB 07-07-The REPT Function-Complete.xlsx
13 KB 7.07 create-in-cell-visualisations - Exercise.docx
43.1 KB Exercise - Create In-Cell Visualization.xlsx
37.1 KB 7.07 create-in-cell-visualisations - Exercise solution.docx
109.5 KB Exercise Solution - Create In-Cell Visualization.xlsx
37.2 KB
Quick reference
Create In-Cell Visualizations: The REPT Function
Use the REPT function to create a dynamic in-cell bar.
When to use
We can use the REPT function to create an in-cell bar whenever we want to extend the capabilities of our visualization by combining the REPT function without other functions and utilities.
Instructions
The REPT function is a hidden gem in Excel. It allows us to repeat text a specified number of times. We can use the REPT function to create a dynamic in-cell bar.
Using REPT to create a bar instead of using data bars is a more flexible option. Data bars can only display in the cell that contains the value and we cannot change the color of individual bars.
In this example, we want to add a bar in the Comparison column that represents the value in the Score column.
We can use the REPT function to do this.
REPT has two arguments: text and number_times.
text - this is the text that we want to repeat.
number_times - the number of times to repeat the text.
In this example, we are using the pipe symbol (vertical bar) as our text. Remember, text within formulas needs to be enclosed within quote marks.
We are using the value in the score column to determine the number of times to repeat the pipe symbol.
- Press Enter and copy the formula down.
- Select the cell range.
- From the Home tab, in the Font group, change the font to Playbill.
The bars are essentially a font, so if we want to change the color, we need to change the font color.
The bars are dynamic, so if the value in the scores column changes, the bars will adjust accordingly.
Add Conditional Formatting
We can make our bars more functional by combining REPT with Conditional Formatting.
For example, we want to show the bar in a different color if the score is below 60.
- Click in cell C8.
- From the Home tab, in the Styles group, click Conditional Formatting.
- Click New Rule.
- Choose Use a formula to determine which cells to format.
This formula will check if the cell is less than 60 or not.
- Click Format.
- Click the Font tab.
- Change the Font color.
- Click OK.
- Click OK again.
- Copy the formula down.
If the value is less than 60, the bar will be green.
Use REPT with a Symbol
We can also use the REPT function with a symbol.
In this example, we want to add a star rating in column I to represent the employee's job rating in column H.
- Click in any blank cell outside of the data.
- From the Insert tab, in the Symbols group, click Symbol.
- From the Symbols tab, change the Font to Wingdings.
- Scroll through the gallery until you see the Star.
- Click Insert.
- Select the star.
- Press CTRL+C to copy.
- Type the REPT function in the cell.
- Press CTRL+V to paste the star in between quote marks.
Notice the star is showing as a chevron. This is because we are not using the correct font.
- Copy the formula down.
- Select the cell range.
- From the Home tab, in the Font group, change the font to Wingdings.
- Change the font color if desired.
Login to download
Lesson notes are only available for subscribers.