0

I have numerous files where the address field is in a single line of text, for the most part separated by a comma. My first step is using 'Replace' function in Excel to replace comma's with a carriage return. This is to turn an address from a single line into multiple lines.

The issue I'm looking to get assistance with, is when I complete the steps above, a leading space is often remaining in all rows from the second row onwards. I would like to know the best way to remove the leading spaces in these rows and keep the format of multi-line addresses.

I have tried using TRIM however these returns the address back to a single line

To show the pre and post transformed data I've added an image below as I can't seem to get the format to show correctly here on this post. Due to my profile being new I also can't imbed the image so there is a link below showing the pre and post transformed data, and the leading space issue I'm seeking help with

Pre and Post Example

Thanks,

Steve

3
  • 1
    You may want to replace “[comma][space]” instead of just “[comma]” with [carriage return] Commented Jul 17, 2022 at 22:14
  • So simple but you're spot on, that works. Thanks for your comment! Commented Jul 18, 2022 at 0:10
  • No worries. To cover both cases you can also try to nest it in one formula: first replace with [space] then wrap around a second replacement without [space] Commented Jul 18, 2022 at 0:16

1 Answer 1

0

As @Anonymous mention in comment, replace both comma and space at a time by SUBSTITUTE() formula and use WRAP TEXT format of resulting cell.

=SUBSTITUTE(A2,", ",CHAR(10))

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.