ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Remove space at beginning of each name (https://www.excelbanter.com/excel-discussion-misc-queries/176083-remove-space-beginning-each-name.html)

Supe

Remove space at beginning of each name
 
I recieved a list that has several hundred names that I was going to do a
VLOOKUP on to put in some data from another spreadsheet. The list I received
has one space at the beginning of each name so the VLOOKUP won't work. How
can I remove this space without going into every single cell and deleting?

Gary''s Student

Remove space at beginning of each name
 
Say the names are in A1 thru A1000. In B1 enter:
=TRIM(A1) and copy down

You can then copy column B and PasteSpecialValue back onto column A if you
like.
--
Gary''s Student - gsnu200768


"Supe" wrote:

I recieved a list that has several hundred names that I was going to do a
VLOOKUP on to put in some data from another spreadsheet. The list I received
has one space at the beginning of each name so the VLOOKUP won't work. How
can I remove this space without going into every single cell and deleting?


Dave Peterson

Remove space at beginning of each name
 
You could use:

Select the column
Data|Text to columns
Fixed width (but remove any lines that excel guessed)
and finish up.

But both leading and trailing spaces will be chopped off. Multiple internal
spaces won't be changed.

=trim() will get rid of leading/trailing and multiple internal spaces.

Supe wrote:

I recieved a list that has several hundred names that I was going to do a
VLOOKUP on to put in some data from another spreadsheet. The list I received
has one space at the beginning of each name so the VLOOKUP won't work. How
can I remove this space without going into every single cell and deleting?


--

Dave Peterson

Don Guillett

Remove space at beginning of each name
 
how about

for each c in range("a2:a22")
c.value=ltrim(c)
next c

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Supe" wrote in message
...
I recieved a list that has several hundred names that I was going to do a
VLOOKUP on to put in some data from another spreadsheet. The list I
received
has one space at the beginning of each name so the VLOOKUP won't work.
How
can I remove this space without going into every single cell and deleting?




All times are GMT +1. The time now is 09:04 PM.

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