REPEAT


Returns a string that is repeated a specified number of times

Syntax:

REPEAT(text, number_of_times)


text is the text that you want to repeat.


number_of_times is how many times you want the text to repeat.


Example:

If text contains Hello and number_of_times contains 3:

REPEAT("Hello", 3)

returns HelloHelloHello


Text:


Number of times:


Result:

HelloHelloHello

Application:

The REPEAT function is often used to generate visual representations or to pad strings to a certain length. It repeats a given string a specified number of times.


Example: Generating a simple bar chart within a spreadsheet


Imagine you have a table showing the sales performance of different products. You want to create a simple, text-based bar chart directly next to the sales numbers to give a quick visual overview of which products are performing best.

Product

Sales

Bar Chart

A
B
C
1
A
5
█████
2
B
8
████████
3
C
3
███
4
D
10
██████████

In this table:

  • The REPEAT function is used in the "Bar Chart" column.
  • The first argument to REPEAT is the character you want to repeat, which is "█" (a block character).
  • The second argument is the number of times to repeat the character, which is the value in the "Sales" column (e.g., cell B2, B3, etc.).




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof