REPT in WPS Spreadsheet: Build Auditable Text Bars and Zero-Padded Labels
Repeat text in WPS Spreadsheet, explain fractional counts and dated length limits and build visible bars or minimum-width labels without losing the original numbers.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: REPT repeats a text string a stated number of times. =REPT("ab",3) has expected text ababab. The dated WPS lesson specifies empty text for a zero count and truncation when the count is not an integer.
Availability and version history
- Introduced: documented by 2019-05-29 in WPS material; the first release is not established.
- Availability: the dated official lesson identifies WPS Office for Windows Personal.
- Scope: exact supported builds and other WPS clients remain unverified.
- Checked: October 14, 2026. Documentation and independent examples; no native WPS execution.
Syntax and historical limits
=REPT(text,number_times)
Both arguments are required. Text supplies the repeated unit, and number_times supplies the count. Repeating a two-character unit three times produces six characters, not three.
The May 29, 2019 Windows Personal lesson documents a 32,767-character result limit, with #VALUE! when the result exceeds it. This is a dated product statement; a maximum for every current WPS build has not been independently established.
The walkthrough says counts must be positive but immediately provides the zero-count exception. Read that alongside the formal zero rule rather than excluding zero from the function’s documented behavior.
Example 1: separate repetitions from character length
Enter the inputs in A2:B5. Put =REPT(A2,B2) in C2 and =LEN(C2) in D2; fill down. The last two columns below show expected output.
| A, text unit | B, count | C, expected text | D, length |
|---|---|---|---|
| ab | 3 | ababab | 6 |
| x | 5 | xxxxx | 5 |
| -+ | 2 | -+-+ | 4 |
| z | 0 | Empty text | 0 |
The zero case is a formula returning empty text, not an untouched cell. It can look blank while retaining a formula and a result type.
LEN provides an independent check of the ASCII output lengths. The general relation for these nonnegative whole-number inputs is unit length multiplied by repetition count.
Example 2: understand positive fractional counts
For =REPT("ab",2.9), the documented truncation rule yields two repetitions: abab, with length four. =REPT("ab",0.9) yields empty text because truncation produces zero.
This differs from rounding 2.9 to three. Do not use a visual display rounded to a whole number as evidence of the count passed to REPT.
The walkthrough explicitly assigns #VALUE! to a negative repetition count. This guide does not try to resolve error-versus-truncation precedence for a negative fraction near zero; use nonnegative counts in the worked designs.
Advanced example: build a transparent text bar
In A9:A12 enter quantities 0, 2, 5 and 3. In B9 use =REPT("|",A9) and fill down. Expected bars contain 0, 2, 5 and 3 vertical marks.
Keep A visible beside the bar. The numeric quantities total 10 with =SUM(A9:A12). B is text presentation, not a replacement for the numeric measure.
For very large quantities, a display cap can preserve readability. In C9 use:
=REPT("|",IF(A9>8,8,A9))
For the existing rows this changes nothing. Change A11 from five to twelve: its displayed bar now has 8 marks, but its underlying quantity is still 12 and the numeric total becomes 17.
Label such a bar as capped at eight. Otherwise a reader could reasonably interpret eight marks as the actual quantity. The cap also does not validate negative, nonnumeric or missing inputs; those need a separate input policy.
Advanced example: add leading zeros without discarding long identifiers
In A16:A19 enter the formulas ="7", ="42", ="12345" and ="123456". These explicitly create text identifiers. In B16 use:
=REPT("0",MAX(0,5-LEN(A16)))&A16
Fill down. Expected outputs are 00007, 00042, 12345 and 123456. The zero counts are 4, 3, 0 and 0.
MAX prevents a negative repeat count when an identifier already exceeds five characters. This creates a minimum width, not an exact width: the six-character identifier remains six characters rather than being silently truncated.
The concatenation operator joins text. Converting these labels back into numbers would remove their leading-zero presentation. Keep numeric quantities and identifiers separate according to what the data represents.
Check the dated length boundary mathematically
For a one-character unit, 32,767 repetitions reach the documented limit; 32,768 exceed it. For ab, 16,383 repetitions produce 32,766 characters, while 16,384 produce 32,768.
Those are arithmetic checks against the historical rule, not native boundary tests performed in a current WPS release. The guide does not generate giant output strings or infer a newer maximum.
Errors and practical limits
A negative count and an overlong result are explicitly assigned #VALUE! in the dated lesson. Other coercion and error-precedence cases are not comprehensively documented there.
Text bars also depend on font width and cell layout. They are useful compact labels, but a proportional font or clipped column can distort their visual comparison. Preserve the numeric source and use a proper chart when exact visual scale matters.
References and verification
Complete function-specific sources reviewed. Expected results are independently derived controls, not native application captures. Formulas use English names and comma separators; check the installed locale.