Formualizer Docs

REPT

Repeats text a given number of times.

Repeats a text string a specified number of times.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=REPT(text, number_times)

Arguments

ArgumentTypeRequiredDefault
textanyRequired—
number_timesanyRequired—

Return type

Can return text.

Remarks

  • Repeat count is truncated to an integer.
  • Non-text first argument is coerced to text.

Error cases

  • Negative counts return #VALUE!, including fractions such as -0.5.
  • Output longer than 32,767 characters returns #VALUE!.

Examples

Repeat a two-character string three times.

Formula =REPT("ab",3)

Expected result ababab

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use a fractional count to see how it is reduced to an integer.

Formula =REPT("ab",2.8)

Expected result abab

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Zero repetitions produce empty text.

Formula =REPT("ab",0)

Expected result ""

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A negative repetition count is invalid.

Formula =REPT("ab",-1)

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Negative count

Formula =REPT("x", -1)

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Can REPT return very long strings?

Only up to 32,767 characters; longer results return #VALUE! like Excel.

Implementation

Engine source

On this page