Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default find beginning of line to first space?

Hello all,

I have some cells that look like this

1 One
02 Two
003 Three
4 Four
000005 Five

and I am looking for a way to cut and paste the number into a new
column. I am guessing I should search and select anything from
the beginning of the line to the first space. I could then cut this
value and place it elsewhere.

I am not certain how to perform this kind of search in Excel though?
Could someone give me an example of how to search from the beginning of
a cell to the first space?

TIA,

Lance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default find beginning of line to first space?

On Apr 27, 12:15*pm, Lance wrote:
I have some cells that look like this
1 One
02 Two
003 Three
4 Four
000005 Five
and I am looking for a way to cut and paste the number
into a new column. *I am guessing I should search and
select anything from the beginning of the line to the
first space. *I could then cut this value and place it
elsewhere.


You could do that. See below. But perhaps the easiest way is to use
the Text To Column feature. In XL2003, click on Data Text To
Column, select an appropriate delimiter, click Next to move along, and
in the last menu, select Skip for the second column and select where
you would like the result.

If you want to retain the leading zeros, either mark the column as
Text before clicking Finish, or afterwards choose an appropriate
Custom format, e.g. 000000.

As for a function, you might use the following paradigm:

=LEFT(A1,FIND(" ",A1)-1)

or

=--LEFT(A1,FIND(" ",A1)-1)

The first form produces text, which preserves leading zeros. The
second form produces numeric results, which would require a Custom
format to display leading zeros.

Caveat: The blanks you see might be non-breaking spaces (HTML  )
instead of normal spaces. In that case, replace " " with CHAR(160).
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default find beginning of line to first space?

On Apr 27, 2:15*pm, Lance wrote:
Hello all,

I have some cells that look like this

1 One
02 Two
003 Three
4 Four
000005 Five

and I am looking for a way to cut and paste the number into a new
column. *I am guessing I should search and select anything from
the beginning of the line to the first space. *I could then cut this
value and place it elsewhere.

I am not certain how to perform this kind of search in Excel though?
Could someone give me an example of how to search from the beginning of
a cell to the first space?

TIA,

Lance


Lots of ways:
datatext to columns
formula using FIND or SEARCH
macro using INSTR
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default find beginning of line to first space?

On Apr 27, 12:31*pm, joeu2004 wrote:
Caveat: *The blanks you see might be non-breaking spaces
(HTML *)


Interesting: my broswer (at least) changed the text I wrote after
"HTML". I wrote ampersand nbsp semicolon, the HTML element
representing a non-breaking space.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default find beginning of line to first space?

on 4/27/2011, Lance supposed :
Hello all,

I have some cells that look like this

1 One
02 Two
003 Three
4 Four
000005 Five

and I am looking for a way to cut and paste the number into a new column. I
am guessing I should search and select anything from
the beginning of the line to the first space. I could then cut this value
and place it elsewhere.

I am not certain how to perform this kind of search in Excel though?
Could someone give me an example of how to search from the beginning of
a cell to the first space?

TIA,

Lance


Enter the following formula into the cell[s] where you want the
results.

=LEFT(A1,FIND(" ",A1)-1)

Be sure to change the ref to 'A1' to match the 1st source cell, then
copy down (or to) other cells as desired.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default find beginning of line to first space?

=LEFT(A1,FIND(" ",A1)-1) works like a charm. Thanks very much.

Lance


On 4/27/2011 2:37 PM, GS wrote:
on 4/27/2011, Lance supposed :
Hello all,

I have some cells that look like this

1 One
02 Two
003 Three
4 Four
000005 Five

and I am looking for a way to cut and paste the number into a new
column. I am guessing I should search and select anything from
the beginning of the line to the first space. I could then cut this
value and place it elsewhere.

I am not certain how to perform this kind of search in Excel though?
Could someone give me an example of how to search from the beginning of
a cell to the first space?

TIA,

Lance


Enter the following formula into the cell[s] where you want the results.

=LEFT(A1,FIND(" ",A1)-1)

Be sure to change the ref to 'A1' to match the 1st source cell, then
copy down (or to) other cells as desired.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I delete a space in the beginning of a cell... GSimone Excel Discussion (Misc queries) 2 April 3rd 23 04:41 PM
enter does 1 line space- scanner does 2 line space need 1 line lockboat New Users to Excel 0 September 6th 08 02:20 PM
Delete space at beginning rexmann Excel Discussion (Misc queries) 4 May 19th 08 12:24 PM
Remove space at beginning of each name Supe Excel Discussion (Misc queries) 3 February 8th 08 06:19 PM
eliminate space at beginning of line Finger Tips Excel Worksheet Functions 1 June 1st 07 12:55 AM


All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"