Skip to main content

Excel Formula: Make text same length

If there is a list of texts with different lengths, for looking nicer, you can make these text with same length by adding trailing characters as below screenshot shown. Here it provides a formula which combines the LEN and REPT functions to handle it in Excel.
doc check if contains some but not others 1

Generic formula:



Text: the cell or text you want to change it to a fixed length.
Fix_length: the length of characters you want to use.
Char: the specific character you used to fix the length of text with.

How this formula work

Here will change the text strings in range C3:C7 to the same length – 8 characters, and output the results in range D3:D7, please use below formula in cell D3:


Press Enter key, the drag fill handle from D3 to D7 to change the texts to same length.
doc make text same length 2


LEN function: tthe LEN function counts the number of characters in the text.

REPT function: the REPT function repeats a character specific number of times. Here the formula =REPT("-",8-LEN(C3)) will repeat the character "-" a specific number of times based on the length of text in C3. You can see this formula as
= REPT("-",8-7)
= REPT("-",1)


If you want to add leading characters to make the texts in fixed length, you can use this formula


Sample File

doc sampleClick to download sample file

Relative Formulas

  • Check if a cell contains a specific text
    To check if a cell contains some texts in range A but does not contain the texts in range B, you can use an array formula which combines the COUNT, SEARCH and AND function in Excel
  • Check if a cell contains one of several values but exclude other values
    This tutorial will provide a formula to quickly handle the task that check if a cell contains one of things but excluding other values in Excel and explain the arguments of the formula.
  • Check if cell contains one of things
    Supposing in Excel, there is a list of values in column E, you want to check if the cells in column B contain all of the values in column E, and return TRUE or FALSE.
  • Check if cell contains number
    Sometimes, you may want to check if a cell contains numeric characters. This tutorial provides a formula which will return TRUE if the cell contains number, FALSE if cell does not contain number.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations