ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Removing spaces in cell (https://www.excelbanter.com/excel-worksheet-functions/128245-removing-spaces-cell.html)

Tom

Removing spaces in cell
 
Hello,

When importing external data into excel, I end up with 2 blank spaces
before the data. Need to remove the 2 blanks spaces for all the cells
in that column. Changed the format and tried decreasing indent,
neither worked.

Is there a formula or VBA code that would work?

Thanks,
Tom


Roger Govier

Removing spaces in cell
 
Hi Tom

If you are sure it is always 2 spaces, then in another column enter
=MID(A1,3,255)
and copy down
When finished copy your new column and Paste SpecialValues back over
the original data to "fix the data".
The helper column can then be deleted.

Alternatively, if the data doesn't have other spaces within the source
cells you could use
=SUBSTITUTE(A1," ","")
and repeat as above.

--
Regards

Roger Govier


"Tom" wrote in message
oups.com...
Hello,

When importing external data into excel, I end up with 2 blank spaces
before the data. Need to remove the 2 blanks spaces for all the cells
in that column. Changed the format and tried decreasing indent,
neither worked.

Is there a formula or VBA code that would work?

Thanks,
Tom




Gary''s Student

Removing spaces in cell
 
use the TRIM() function
--
Gary's Student
gsnu200703


"Tom" wrote:

Hello,

When importing external data into excel, I end up with 2 blank spaces
before the data. Need to remove the 2 blanks spaces for all the cells
in that column. Changed the format and tried decreasing indent,
neither worked.

Is there a formula or VBA code that would work?

Thanks,
Tom



T. Valko

Removing spaces in cell
 
Here's a link to a nice little macro that's perfect for this:

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

Biff

"Tom" wrote in message
oups.com...
Hello,

When importing external data into excel, I end up with 2 blank spaces
before the data. Need to remove the 2 blanks spaces for all the cells
in that column. Changed the format and tried decreasing indent,
neither worked.

Is there a formula or VBA code that would work?

Thanks,
Tom




Tom

Removing spaces in cell
 
Got it working with the macro. Tried the =MID(A1,3,255) but didn't
work for me as needed.

Thanks to all,
Tom


On Jan 29, 2:33 pm, "T. Valko" wrote:
Here's a link to a nice little macro that's perfect for this:

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

Biff

"Tom" wrote in ooglegroups.com...



Hello,


When importing external data into excel, I end up with 2 blank spaces
before the data. Need to remove the 2 blanks spaces for all the cells
in that column. Changed the format and tried decreasing indent,
neither worked.


Is there a formula or VBA code that would work?


Thanks,
Tom- Hide quoted text -- Show quoted text -




All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com