Excel - REPT Function



REPT Function

The EXCEL REPT function repeatedly populates the text a predetermined number of times and always retrieves the text value as an output. It may generate simple histograms, bar charts, and unique patterns and is categorized under the Excel LOGICAL function. It works smoothly with quantitative and qualitative values. The formatting of numbers and dates will also persist when evaluating the REPT function. This function is also joined with other functions like SUBSTITUE, TRIM, LEN, MATCH, etc.

Compatibility

This prominent Logical Excel function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the REPT function is as follows −

REPT (text, number_times)

Arguments

You can use the following arguments with the REPT function −

Argument Description Required / Optional
Text A cell reference that points to the text/ a text string to enable the repetition process. Required
Number_times A nonnegative numeric value represents the number of times for text repetitions. Required

Points To Remember

  • If the number_times contains the negative value, the REPT function will return the #VALUE! error.
  • If the number_times equals 0, the REPT function will retrieve the empty string " ".
  • If the noninteger value is specified in the Number_times, it gets truncated.
  • If the resulting value exceeds 32,767 characters, the REPT function will retrieve the #VALUE! Error.
  • It works smoothly with the Date, punctuation, and special characters, and number formatting will also be retained after execution of the REPT function.

How to use the REPT function in Excel?

The step-by-step explanation is written below −

  • Open a new worksheet in Microsoft Excel.
  • Place the cursor on the specific cell and double-click on it.
  • Type the = sign and then write the REPT("text"/cell reference that refers to text, number_times).
  • Hit the Enter tab to get the computed value.

Examples of REPT Function

Practice the following examples to learn how to use the REPT function in Excel.

Example 1

Step 1 − First, assume the sample dataset consists of the Text, Number Times, and Result columns.

Use of REPT Function in Excel1

Step 2 − Afterward, select the cell range D3:D11 and write the formula =REPT(B3,C3) in the formula bar

Use of REPT Function in Excel2

Step 3 − Finally, press the "ctrl+enter" keys to display the resultant value in the selected range of cells.

Use of REPT Function in Excel3

Example 2: Create a Horizontal Pattern Using the REPT Function

The REPT function in Excel is used to repeat a given text string a specified number of times.

Solution

Consider the sample dataset where the serial number from 10 to 1 is specified in the B column, and you must apply the REPT function in the C column. You can select the cell range C2:C11 and type the formula =REPT("n",B2) in the formula box.

Create Horizontal Pattern Using REPT Function1

After that, press the "ctrl+Enter" keys to obtain the result.

Create Horizontal Pattern Using REPT Function2

Furthermore, select the Font tab and select the "Wingdings" font from the drop-down list.

Create Horizontal Pattern Using REPT Function3

Therefore, the interactive pattern has been generated through the REPT function.

Create Horizontal Pattern Using REPT Function4

Download Practice Sheet

You can download and use the sample data sheet to practice the REPT function.

Advertisements