# REPT formula generator

> Describe what you need and get a REPT formula for Excel and Google Sheets, run on real data before you copy it. Plus 8 tested REPT examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/rept · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

REPT repeats a piece of text a given number of times.

Describe the task at [REPT formula generator](https://spreadsheetpractice.com/tools/formula-generator/rept) and get a REPT formula for Excel and Google Sheets, tested on real data.

## Tested REPT examples

### Repeat a character n times

`=REPT("★",B2)&REPT("☆",5-B2)`

Excel. Result on the sample sheet: 5 rows (C2:C6). [See it and try it](https://spreadsheetpractice.com/formulas/repeat-a-character-n-times)

### Pad text with spaces to a fixed length

`=LEFT(A2&REPT(" ",$E$1),$E$1)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/pad-text-to-a-fixed-length)

### Mask all but the last 4 digits

`=REPT("*",LEN(A2)-4)&RIGHT(A2,4)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/mask-all-but-last-4-digits)

## Questions

### What does the REPT formula generator do?

You describe the task in plain English, and it writes the formula, using REPT where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does REPT do?

REPT repeats a piece of text a given number of times.

### Can I learn to write REPT formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the REPT function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
