Need formula to replaces multiple spaces in cell with line return

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
572
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a situation where the user decided to keep hitting the space bar when entering addresses in a single cell to create the next line of the cell, rather than using "alt + enter". How can I replace these spaces with a line return when pulling this information into another cell of another worksheet with a formula.

The cell contents look like this:

John Doe 999-999-9999 Somewhere America, Inc. 5555 Some Highway Suite 99 Anyplace, MD 12345



Any help would be much appreciated. Thanks, SS
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
John Doe-------------------999-999-9999-------------Somewhere America, Inc.--------------5555 Some Highway----------------Suite 99---------------------Anyplace, MD 12345

Except those dashes you see are actual spaces...
 
Upvote 0
Have you tried: =TRIM(cell)
I tried this:

=IF(CO4="","",TRIM(SUBSTITUTE(XLOOKUP(CO4,'MRL SHPG - In Process'!A:A,'MRL SHPG - In Process'!E:E),CHAR(32)," ")))



However, all that does is remove the multiple spaces and replaces them with a single space. I want to inject a carriage return wherever there are multiple spaces in a the string of text that are back to back.
 
Upvote 0
Wow, that is slick. I've never heard of a "TEXTJOIN" function in a formula before. Thanks, that was exactly what I was after.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top