Tuesday, November 02, 2004

Add spaces to a string in Excel using REPT function

Thanks to Jon from PeltierTech for this one.

Generally when concatenating two text strings where I want a space between in Excel I use the formula:
= CONCATENATE(A1," ",B1)
If I wanted more than one space I would just add additional spaces to the formula.

Here is a better way.
= CONCATENATE(A1,REPT(" ",4),B1)
This formula will add 4 spaces to the string.