Concatenate spaces before each alt-enter seperated value in a cell?

  • Thread starter Thread starter walterbyrd
  • Start date Start date
W

walterbyrd

I hope I am making sense.

Within one cell, I have several values seperated by alt-enter. So it
looks this:

abcdef <alt-enter>
abcdef <alt-enter>
abcedf <alt-enter>

I want spaces before each "abcdef" so it will look like this:

abcdef <alt-enter>
abcdef <alt-enter>
abcedf <alt-enter>
 
This gets close:

=REPT(" ",4)&SUBSTITUTE(A1,CHAR(10),CHAR(10)&REPT(" ",4))

But it actually adds extra characters at the right end of the string.

Change the 4 (in both spots) to how many space characters you want.
 
I hope I am making sense.

Within one cell, I have several values seperated by alt-enter. So it
looks this:

abcdef <alt-enter>
abcdef <alt-enter>
abcedf <alt-enter>

I want spaces before each "abcdef" so it will look like this:

abcdef <alt-enter>
abcdef <alt-enter>
abcedf <alt-enter>

Another approach, if what you want is the "appearance" would be to
right-justify the cell.
--ron
 
Back
Top