Forum Discussion

gcotterl's avatar
gcotterl
Copper Contributor
Aug 07, 2026

REPT problem

a28 contains   COREBRIDGE (RivCo Deferred Comp)

 

In a3, I type =len(a28)

the result is:      32

 

in a4, I type =REPT("=",a3)

the result is   ================================

 

Why is a4 longer than a28?

 

 

 

 

 

3 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    gcotterl​ 

    Alternatively, use a custom format to mimic a string of "=" across the entire width of the column. In the picture below, I've entered a single "=" in A3 and custom formatted the cell with @*=

    "@" stands for Text,

    "*" stands for Repeat,

    "=" is the character you want to fill across the entire column width.

    No matter what font type or size you use, the entire cell A3 will be filled with the desired character, whatever the column width.

     

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    Hi, yes, your explanation is correct. LEN(A28) counts exactly 32 characters, including spaces, and REPT("=",A3) therefore also produces exactly 32 = characters. So there is no problem with either formula.

     

    The reason the result in A4 appears longer is the proportional font: the individual characters do not all have the same visual width. The = character is wider than some of the letters and spaces in A28.

     

    As a quick verification, =LEN(A4) should also return 32. If you change both cells to a monospaced font such as Consolas or Courier New, the two strings will have the same visual width.

     

    As an alternative, if the intention is simply to create a separator or underline below A28, I would recommend using an Excel bottom border instead of REPT. That will remain correctly aligned even if the text, font, zoom level, or column width changes.

     

    So the formulas are working correctly; the difference is only in how Excel displays the characters.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

  • LEN(A28) and REPT("=",A3) are both working correctly. LEN counts the 32 characters in the text, including spaces, and REPT returns exactly 32 equals signs. The apparent difference is visual, not a formula-length difference: Excel normally uses a proportional font, so each character has its own width. Uppercase letters, lowercase letters, spaces, parentheses, and the equals-sign glyph do not occupy equal horizontal space, even when the character counts match. You can verify this with =LEN(A4), which should also return 32. If you need a text ruler whose repeated characters line up predictably, apply the same monospaced font, such as Consolas or Courier New, to both cells. If the goal is to underline or separate the label, do not build the line with REPT; apply a bottom border to the cell or range instead. A border remains aligned when the column width, zoom, font, or displayed text changes.