Remove blank spaces from cells where number varies

  • Thread starter Thread starter Legacy 177768
  • Start date Start date
L

Legacy 177768

Guest
We have some spreadsheets where people have been using blank spaces to force text to appear to be on a next line (instead of doing an Alt+Enter line break).

I have to copy the contents of these spreadsheets up to a SharePoint List, and when I do, the extra spaces (in Column I, for example) throw off the sizing in that column in SharePoint. So, I need to clean up these cells *before* I do my copy and paste to the online List.

How to I search through cells in a column in Excel to remove various lengths of empty spaces? One cell might have groups of text with 20 spaces between them, and another cell might have some text with 5 spaces between.

It would seem I need to remove anything more than a single space down to 2 spaces, and then insert a line break (Alt+Enter) in those places, so the text break is moved to a new line within the cell.

Thanks for your help! :)
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
We have some spreadsheets where people have been using blank spaces to force text to appear to be on a next line (instead of doing an Alt+Enter line break).

I have to copy the contents of these spreadsheets up to a SharePoint List, and when I do, the extra spaces (in Column I, for example) throw off the sizing in that column in SharePoint. So, I need to clean up these cells *before* I do my copy and paste to the online List.

How to I search through cells in a column in Excel to remove various lengths of empty spaces? One cell might have groups of text with 20 spaces between them, and another cell might have some text with 5 spaces between.

It would seem I need to remove anything more than a single space down to 2 spaces, and then insert a line break (Alt+Enter) in those places, so the text break is moved to a new line within the cell.

Thanks for your help! :)
The macro at this website will remove all leading/trailing and multiple interspersed char 32 space characters. It will also remove and/or convert char 160 non breaking spaces into standard char 32 space characters.
It will work on text or numbers and the numbers will be converted to true numeric numbers.

I use this macro dozens of times every single day! It is a real time saver.

http://www.mvps.org/dmcritchie/excel/join.htm#trimall
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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