A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Extract Numerics only



 
 
Thread Tools Display Modes
  #31  
Old September 20th, 2006, 09:01 PM posted to microsoft.public.excel.misc
ameron
external usenet poster
 
Posts: 3
Default Extract Numerics only



"Bob Phillips" wrote:

You might want to convert that to a number

=--LOOKUP(REPT("z",255),MID(A1,MIN(SEARCH({0,1,2,3,4, 5,6,7,8,9},A1&"01234567
89
")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Peo Sjoblom" wrote in message
...
The reason the first returns 769142 is that the extracted value 11-4005
is seen as a date so Excel translates the date as 11/01/05 which is 769142
days after Jan 0 1900 Excel's first date, given that the
numbers can be so different it is hard to guard against, try this

adaptation
of Domenic's excellent formula


=LOOKUP(REPT("z",255),MID(A1,MIN(SEARCH({0,1,2,3,4 ,5,6,7,8,9},A1&"0123456789
")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}))


--

Regards,

Peo Sjoblom

"Corey" wrote in message
...
Thanks for all the suggestions people. I'm not to familiar with VBA nor

UDF.
Also, I'm trying to put together a tool for a below novice user of Excel

as
it takes her hours to decipher a statement. I was hoping to use just a

simple
formula and have her cut and paste the data to have it automatically

populate
with this formula. I've tried yours Domenic, and it seems to work for

the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...


=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...


=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out

the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!






  #32  
Old September 20th, 2006, 09:06 PM posted to microsoft.public.excel.misc
ameron
external usenet poster
 
Posts: 3
Default Extract Numerics only



"Domenic" wrote:

Maybe...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),SUMPRODUCT(LEN
(A1)-LEN(SUBSTITUTE(A1,{"-",0,1,2,3,4,5,6,7,8,9},""))))

....which will return...

11-4005
040652
3127
2679
20
130

....when you have the following...

OFF 11-4005
ON 040652
ON 3127
ON2679
O/F 20R
OFF///130H

Hope this helps!

In article ,
"Corey" wrote:

Thanks for all the suggestions people. I'm not to familiar with VBA nor UDF.
Also, I'm trying to put together a tool for a below novice user of Excel as
it takes her hours to decipher a statement. I was hoping to use just a simple
formula and have her cut and paste the data to have it automatically populate
with this formula. I've tried yours Domenic, and it seems to work for the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!


  #33  
Old September 20th, 2006, 09:16 PM posted to microsoft.public.excel.misc
ameron
external usenet poster
 
Posts: 3
Default Extract Numerics only

WHO-EVER YOU A a million thanks for your varied posts and replies. I am a
research chemist and needed to find a formula to extract numbers from text
(complex elements from the periodic table) and manipulate them. By sheer luck
and a half hour of trying I lucked out in finding a reply which answered my
search. I have no idea of what I copied but it worked! My name is Eef (Dutch)
and work at the "Chemisse Fabrieken, Simpelveld, Nederland. I say KUDOS to
all of you..

"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!

  #34  
Old July 24th, 2007, 05:38 PM posted to microsoft.public.excel.misc
BurghRocks
external usenet poster
 
Posts: 12
Default A Different approach that may work

Ron - Don't know if you are still monitoring this or will receive an email
notification of this post but I wanted to thank you for this excellent tool.
It's saved me a lot of time and trouble and its much appreciated. That's
besides the fact that its going to make me look good too!

Thanks,
Bill

"Ron Coderre" wrote:

I've been playing with this formula, which pulls from the first digit found
thru the last digit found:

=MID(A1,MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),1+MAX(--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*ROW(INDIREC T("1:"&LEN(A1))))-MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0))

Note: Commit that array formula by holding down the [Ctrl] and [Shift] keys
when you press [Enter].

So...
"OFF 11-4005ABC" would result in 11-4005
"OFF///130H" would result in 130
etc

I think that handles all of the pertinent scenarios...let me know.

***********
Regards,
Ron


"Ron Coderre" wrote:

Nope....it misses punctuation within the numbers, as in:
OFF 11-4005

***********
Regards,
Ron


"Ron Coderre" wrote:

I know this is a bit late, but I just came up with this, which seems to work
well:

=MID(A1,MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),COUNT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))

If finds the first digit location and the count of digits in the string and
uses those values in the MID function.

***********
Regards,
Ron


"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!

  #35  
Old July 24th, 2007, 05:56 PM posted to microsoft.public.excel.misc
Ron Coderre
external usenet poster
 
Posts: 620
Default A Different approach that may work

That post is a year and a half old, but feedback is always welcome. Thanks
for taking the time to let me know that formula helped you out., Bill. Much
appreciated.


***********
Best Regards,
Ron

XL2003, WinXP


"BurghRocks" wrote:

Ron - Don't know if you are still monitoring this or will receive an email
notification of this post but I wanted to thank you for this excellent tool.
It's saved me a lot of time and trouble and its much appreciated. That's
besides the fact that its going to make me look good too!

Thanks,
Bill

"Ron Coderre" wrote:

I've been playing with this formula, which pulls from the first digit found
thru the last digit found:

=MID(A1,MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),1+MAX(--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*ROW(INDIREC T("1:"&LEN(A1))))-MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0))

Note: Commit that array formula by holding down the [Ctrl] and [Shift] keys
when you press [Enter].

So...
"OFF 11-4005ABC" would result in 11-4005
"OFF///130H" would result in 130
etc

I think that handles all of the pertinent scenarios...let me know.

***********
Regards,
Ron


"Ron Coderre" wrote:

Nope....it misses punctuation within the numbers, as in:
OFF 11-4005

***********
Regards,
Ron


"Ron Coderre" wrote:

I know this is a bit late, but I just came up with this, which seems to work
well:

=MID(A1,MATCH(1,--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),COUNT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))

If finds the first digit location and the count of digits in the string and
uses those values in the MID function.

***********
Regards,
Ron


"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!

  #36  
Old January 8th, 2008, 07:20 PM posted to microsoft.public.excel.misc
katdot
external usenet poster
 
Posts: 4
Default Extract Numerics only

This is the only one that works for me, but I lose the last number. My values
look more like this:

1+0756
1+0789AH
1+0478BK

I know this is an old topic, but hopefully someone can help.


"Domenic" wrote:

Maybe...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),SUMPRODUCT(LEN
(A1)-LEN(SUBSTITUTE(A1,{"-",0,1,2,3,4,5,6,7,8,9},""))))

....which will return...

11-4005
040652
3127
2679
20
130

....when you have the following...

OFF 11-4005
ON 040652
ON 3127
ON2679
O/F 20R
OFF///130H

Hope this helps!

In article ,
"Corey" wrote:

Thanks for all the suggestions people. I'm not to familiar with VBA nor UDF.
Also, I'm trying to put together a tool for a below novice user of Excel as
it takes her hours to decipher a statement. I was hoping to use just a simple
formula and have her cut and paste the data to have it automatically populate
with this formula. I've tried yours Domenic, and it seems to work for the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!


  #37  
Old January 8th, 2008, 09:34 PM posted to microsoft.public.excel.misc
T. Valko
external usenet poster
 
Posts: 15,759
Default Extract Numerics only

1+0756
1+0789AH
1+0478BK

What results do you expect/want?


--
Biff
Microsoft Excel MVP


"katdot" wrote in message
...
This is the only one that works for me, but I lose the last number. My
values
look more like this:

1+0756
1+0789AH
1+0478BK

I know this is an old topic, but hopefully someone can help.


"Domenic" wrote:

Maybe...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),SUMPRODUCT(LEN
(A1)-LEN(SUBSTITUTE(A1,{"-",0,1,2,3,4,5,6,7,8,9},""))))

....which will return...

11-4005
040652
3127
2679
20
130

....when you have the following...

OFF 11-4005
ON 040652
ON 3127
ON2679
O/F 20R
OFF///130H

Hope this helps!

In article ,
"Corey" wrote:

Thanks for all the suggestions people. I'm not to familiar with VBA nor
UDF.
Also, I'm trying to put together a tool for a below novice user of
Excel as
it takes her hours to decipher a statement. I was hoping to use just a
simple
formula and have her cut and paste the data to have it automatically
populate
with this formula. I've tried yours Domenic, and it seems to work for
the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out
the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!




  #38  
Old January 9th, 2008, 01:29 PM posted to microsoft.public.excel.misc
katdot
external usenet poster
 
Posts: 4
Default Extract Numerics only

I need to pull out just the numbers. So ...

1+0756 10756
1+0789AH 10789.

The formula from Domenic gives me results, but chops off the last number. So
....

1+0478BK 1+047
1+0756 1+075
1+0789AH 1+078

I don't have enough knowledge to figure out what's going wrong.

"T. Valko" wrote:

1+0756
1+0789AH
1+0478BK

What results do you expect/want?


--
Biff
Microsoft Excel MVP


"katdot" wrote in message
...
This is the only one that works for me, but I lose the last number. My
values
look more like this:

1+0756
1+0789AH
1+0478BK

I know this is an old topic, but hopefully someone can help.


"Domenic" wrote:

Maybe...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),SUMPRODUCT(LEN
(A1)-LEN(SUBSTITUTE(A1,{"-",0,1,2,3,4,5,6,7,8,9},""))))

....which will return...

11-4005
040652
3127
2679
20
130

....when you have the following...

OFF 11-4005
ON 040652
ON 3127
ON2679
O/F 20R
OFF///130H

Hope this helps!

In article ,
"Corey" wrote:

Thanks for all the suggestions people. I'm not to familiar with VBA nor
UDF.
Also, I'm trying to put together a tool for a below novice user of
Excel as
it takes her hours to decipher a statement. I was hoping to use just a
simple
formula and have her cut and paste the data to have it automatically
populate
with this formula. I've tried yours Domenic, and it seems to work for
the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull out
the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!





  #39  
Old January 9th, 2008, 02:15 PM posted to microsoft.public.excel.misc
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Extract Numerics only

On Tue, 8 Jan 2008 11:20:02 -0800, katdot
wrote:

This is the only one that works for me, but I lose the last number. My values
look more like this:

1+0756
1+0789AH
1+0478BK

I know this is an old topic, but hopefully someone can help.


This UDF will return all the numbers in the string. If there are NO numbers,
it returns #VALUE! That can be modified, if you wish.

================================
Option Explicit
Function Nums(str As String) As Double
Dim re As Object, mc As Object
Const sPat As String = "\D"
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = sPat
Nums = re.Replace(str, "")
End Function
===================================

To enter this alt-F11 opens the VBEditor. Ensure your project is highlighted
in the project explorer window, then Insert/Module and paste the code above
into the window that opens.

Then use the formula =Nums(cell_ref) on your worksheet.
--ron
  #40  
Old January 9th, 2008, 02:32 PM posted to microsoft.public.excel.misc
Ron Coderre
external usenet poster
 
Posts: 1,922
Default Extract Numerics only


Solution from Harlan Grove
A1: abc123def456ghi789

First, create a Named Formula
Names in Workbook: Seq
Refers to: =ROW(INDEX($1:$65536,1,1):INDEX($1:$65536,255,1))

This ARRAY FORMULA
(committed with CTRL+SHIFT+ENTER, instead of just ENTER)
removes ALL non-numerics from a string.

In sections, for readability:
B1: =SUM(IF(ISNUMBER(1/(MID(A1,seq,1)+1)),MID(A1,seq,1)*
10^MMULT(-(seqTRANSPOSE(seq)),-ISNUMBER(1/(MID(A1,seq,1)+1)))))

In the example, the formula returns: 123456789

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"katdot" wrote in message
...
I need to pull out just the numbers. So ...

1+0756 10756
1+0789AH 10789.

The formula from Domenic gives me results, but chops off the last number.
So
...

1+0478BK 1+047
1+0756 1+075
1+0789AH 1+078

I don't have enough knowledge to figure out what's going wrong.

"T. Valko" wrote:

1+0756
1+0789AH
1+0478BK

What results do you expect/want?


--
Biff
Microsoft Excel MVP


"katdot" wrote in message
...
This is the only one that works for me, but I lose the last number. My
values
look more like this:

1+0756
1+0789AH
1+0478BK

I know this is an old topic, but hopefully someone can help.


"Domenic" wrote:

Maybe...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),SUMPRODUCT(LEN
(A1)-LEN(SUBSTITUTE(A1,{"-",0,1,2,3,4,5,6,7,8,9},""))))

....which will return...

11-4005
040652
3127
2679
20
130

....when you have the following...

OFF 11-4005
ON 040652
ON 3127
ON2679
O/F 20R
OFF///130H

Hope this helps!

In article ,
"Corey" wrote:

Thanks for all the suggestions people. I'm not to familiar with VBA
nor
UDF.
Also, I'm trying to put together a tool for a below novice user of
Excel as
it takes her hours to decipher a statement. I was hoping to use just
a
simple
formula and have her cut and paste the data to have it automatically
populate
with this formula. I've tried yours Domenic, and it seems to work
for
the
most part, except for some:

OFF 11-4005 returns 769142
ON 040652 returns 40652 (losing the first 0)




"Domenic" wrote:

If your numbers are not more than 15 digits in length, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),{1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15}))

Otherwise, try...

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A
1&"0123456789")),ROW(INDIRECT("1:"&LEN(A1)))))

Hope this helps!

In article ,
"Corey" wrote:

Hello. I have a column with data that contain numerics and text:

ON 3127
ON2679
O/F 20R
OFF///130H

Is there a formula I can input in an adjacent cell to only pull
out
the
numbers to give me the following:

3127
2679
20
130

Any help is appreciated. Thanks!








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a tip about how to extract .SWFfile from PowerPoint file SusanZheng Powerpoint 1 November 3rd, 2005 03:58 AM
Extract records with a specific field appearing more than once in the DB markx Running & Setting Up Queries 7 September 28th, 2005 06:44 PM
Trendline Extract Phil Hageman Charts and Charting 5 July 6th, 2005 02:27 AM
Extract Unique Values, Then Extract Again to Remove Suffixes Karl Burrows General Discussion 23 June 25th, 2005 10:37 PM
Extract specific data into its own workbook via macro? Adrian B General Discussion 2 February 24th, 2005 06:09 AM


All times are GMT +1. The time now is 03:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.