Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bill gras
 
Posts: n/a
Default extract numbers from cell problem

I have a column with numbers that I split up and extract from e g:
A
1 5-14 3.2L
2 11-14*3.6L
3 +1-12 0.5L
4 10-16 5.1L
5 +1-12*0.2L
I used a function to delete the +,*,L as follows:
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"*"," "),"L","")
that leaves me with column "B" as follows
B
1 5-14 3.2
2 11-14 3.6
3 1-12 0.5
4 10-16 5.1
5 1-12 0.2
then I extract from column "B" numbers as follows
column column column
C D E
1 5 14 3.2
2 11 14 3.6
3 1 12 0.5
4 10 16 #value! should be 5.1
5 1 12 0.2

A1 has the same number content as A4 , yet A4 returns an error
I tried different formats but no luck
Has it something to do with B1 has 7 caracters and B4 has 8 caracters ?

can some one please help
thanks
bill

--
bill gras
  #2   Report Post  
bj
 
Posts: n/a
Default extract numbers from cell problem

how are you extracting the numbers?

"bill gras" wrote:

I have a column with numbers that I split up and extract from e g:
A
1 5-14 3.2L
2 11-14*3.6L
3 +1-12 0.5L
4 10-16 5.1L
5 +1-12*0.2L
I used a function to delete the +,*,L as follows:
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"*"," "),"L","")
that leaves me with column "B" as follows
B
1 5-14 3.2
2 11-14 3.6
3 1-12 0.5
4 10-16 5.1
5 1-12 0.2
then I extract from column "B" numbers as follows
column column column
C D E
1 5 14 3.2
2 11 14 3.6
3 1 12 0.5
4 10 16 #value! should be 5.1
5 1 12 0.2

A1 has the same number content as A4 , yet A4 returns an error
I tried different formats but no luck
Has it something to do with B1 has 7 caracters and B4 has 8 caracters ?

can some one please help
thanks
bill

--
bill gras

  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default extract numbers from cell problem

On Thu, 20 Oct 2005 07:26:19 -0700, bill gras
wrote:

I have a column with numbers that I split up and extract from e g:
A
1 5-14 3.2L
2 11-14*3.6L
3 +1-12 0.5L
4 10-16 5.1L
5 +1-12*0.2L
I used a function to delete the +,*,L as follows:
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"*" ," "),"L","")
that leaves me with column "B" as follows
B
1 5-14 3.2
2 11-14 3.6
3 1-12 0.5
4 10-16 5.1
5 1-12 0.2
then I extract from column "B" numbers as follows
column column column
C D E
1 5 14 3.2
2 11 14 3.6
3 1 12 0.5
4 10 16 #value! should be 5.1
5 1 12 0.2

A1 has the same number content as A4 , yet A4 returns an error
I tried different formats but no luck
Has it something to do with B1 has 7 caracters and B4 has 8 caracters ?

can some one please help
thanks
bill


I would guess there's some logic flaw in the method you are using to extract
the numbers; very hard to tell when you do not post the method of extraction,
however.


--ron
  #4   Report Post  
bill gras
 
Posts: n/a
Default extract numbers from cell problem

Hi all
Thank you for your reply

I used this formula in column "L" :-=LEFT(B1,FIND(" ",B1)) result: L

1 5-14

2 11-14

3 1-12

4 10-16

5 1-12
I used for column C this formula:
=VALUE(LEFT(L1,FIND("-",L1)-1))

I used for column D this formula:
=VALUE(IF(ISERROR(FIND("-",L1)),L1,MID(L1,FIND("-",L1,1)+1,99)))

I used for column E this formula:
=VALUE(RIGHT(B1,FIND(" ",B1)-1))

I hope you can help me with this

bill

--
bill gras


"bj" wrote:

how are you extracting the numbers?

"bill gras" wrote:

I have a column with numbers that I split up and extract from e g:
A
1 5-14 3.2L
2 11-14*3.6L
3 +1-12 0.5L
4 10-16 5.1L
5 +1-12*0.2L
I used a function to delete the +,*,L as follows:
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"*"," "),"L","")
that leaves me with column "B" as follows
B
1 5-14 3.2
2 11-14 3.6
3 1-12 0.5
4 10-16 5.1
5 1-12 0.2
then I extract from column "B" numbers as follows
column column column
C D E
1 5 14 3.2
2 11 14 3.6
3 1 12 0.5
4 10 16 #value! should be 5.1
5 1 12 0.2

A1 has the same number content as A4 , yet A4 returns an error
I tried different formats but no luck
Has it something to do with B1 has 7 caracters and B4 has 8 caracters ?

can some one please help
thanks
bill

--
bill gras

  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default extract numbers from cell problem

On Thu, 20 Oct 2005 07:26:19 -0700, bill gras
wrote:

I have a column with numbers that I split up and extract from e g:
A
1 5-14 3.2L
2 11-14*3.6L
3 +1-12 0.5L
4 10-16 5.1L
5 +1-12*0.2L
I used a function to delete the +,*,L as follows:
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"*" ," "),"L","")
that leaves me with column "B" as follows
B
1 5-14 3.2
2 11-14 3.6
3 1-12 0.5
4 10-16 5.1
5 1-12 0.2
then I extract from column "B" numbers as follows
column column column
C D E
1 5 14 3.2
2 11 14 3.6
3 1 12 0.5
4 10 16 #value! should be 5.1
5 1 12 0.2

A1 has the same number content as A4 , yet A4 returns an error
I tried different formats but no luck
Has it something to do with B1 has 7 caracters and B4 has 8 caracters ?

can some one please help
thanks
bill


Well, I've been fooling around with Regular Expressions and I'm not entirely
sure what the optimum one is for this problem. Perhaps Harlan will chime in.

I suspect my use of the [dot] in the character class is not 'good form'. I
note that 0. and 0.0 also work in that position.

In order to use them, download and install Longre's free morefunc.xll add-in
from http://xcell05.free.fr/

The following seems to work to extract the three numbers in your strings:

=REGEX.MID($A1,"[.-99]*",1)
=REGEX.MID($A1,"[.-99]*",2)
=REGEX.MID($A1,"[.-99]*",3)


If you're entering these formulas in columns adjacent to your data, and your
data starts in A1, then:

B1: =REGEX.MID($A1,"[.-99]*",COLUMN()-CELL("col",$A1))

and copy/drag across to column D; and copy/drag down as needed.

If the values need to be NUMERIC and not TEXT, then precede the formula with a
double unary:

B1: =--REGEX.MID($A1,"[.-99]*",COLUMN()-CELL("col",$A1))


--ron


  #6   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default extract numbers from cell problem

On Thu, 20 Oct 2005 21:18:03 -0700, bill gras
wrote:

Hi all
Thank you for your reply

I used this formula in column "L" :-=LEFT(B1,FIND(" ",B1)) result: L

1 5-14

2 11-14

3 1-12

4 10-16

5 1-12
I used for column C this formula:
=VALUE(LEFT(L1,FIND("-",L1)-1))

I used for column D this formula:
=VALUE(IF(ISERROR(FIND("-",L1)),L1,MID(L1,FIND("-",L1,1)+1,99)))

I used for column E this formula:
=VALUE(RIGHT(B1,FIND(" ",B1)-1))

I hope you can help me with this

bill



A little more research reveals that the following regular expression is
'better' for matching your numbers.

"[0-9]*\.?[0-9]+"

So the formula would be:

=--REGEX.MID($A1,"[0-9]*\.?[0-9]+",COLUMN()-CELL("col",$A1))


--ron
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 do I keep the zeros in front of numbers when i split a cell tom Excel Worksheet Functions 3 October 11th 05 03:21 AM
How do I hide the zero in the "sum" cell until numbers are put in the cells that are being added? Radman Excel Worksheet Functions 6 October 9th 05 04:25 AM
separating numbers and letters from alphanumeric cell contents PH Excel Worksheet Functions 10 September 3rd 05 12:15 PM
spinner linked cell problem jim Excel Discussion (Misc queries) 2 July 22nd 05 04:08 PM
Copy an Drag cell Formula Problem Nat Excel Discussion (Misc queries) 1 June 20th 05 03:24 PM


All times are GMT +1. The time now is 07:42 AM.

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"