A Quick Bar Chart in Google Sheets Using REPT

The REPT function in Google Sheets creates a string by repeating a smaller string a given number of times.

The syntax is:

REPT(text, number)

where text is a string value, and number (an integer greater than 0) is the number of times that string will be repeated.

We can demonstrate the use of REPT to generate a quick data-visualization bar chart without the hassle of configuring a ‘proper’ chart.

Click image to enlarge

Click image to enlarge

In the sheet shown above, we have student marks listed in column B. Since there are only a few students, it’s pretty quick to read through the data. (Alternatively, we could sort, filter or query it as we’ve shown in previous posts.) Instead, let’s build a quick bar chart.

In cell C2 I’m going to repeat a single character – I’ve used the pipe character (|) – a number of times, corresponding to that student’s mark:

Click image to enlarge

Click image to enlarge

Now all I need to do is copy that formula to the other rows:

Click image to enlarge

Click image to enlarge

Immediately we have a quick way to visualize the data, perhaps picking out any student whose score is way off the mean so we can investigate further.

Of course, to tidy up even further AND make sure our routine can cope with any number of students we might later add to the sheet, instead of copying the formula to the other rows we can enter it as an ARRAYFORMULA, as described in this post:

Click image to enlarge

Click image to enlarge

By entering the scores range as B2:B we ensure that the graph is generated for any populated cell.

Finally, to aid in our data visualization, let’s use conditional formatting to highlight any scores below 50%:

Click image to enlarge

Click image to enlarge

Now, any students with a failing mark will be highlighted in red:

Click image to enlarge

Click image to enlarge