extracting numberic values from text

Robertsexton100

New Member
Joined
Mar 31, 2004
Messages
29
Is there a formula to extract a numberic value from a cell containing both text and numbers?
I have a list of my retail stores which contain their "store number" and their "address" but not always in the same order and because they are all different addresses the length is different for each meaning I cannot use the =left or =right formula or text to columns.

I know this is probably a little basic but does anyone know a formula that will pick out the number only?

Many thanks
For any help
Cheers
Rob
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Rob

Your specification is very incomplete. Besides the data sample with the expected results that Gerald asked, please be thorough when defining the problem. How is the number: always an integer or sometimes with decimals? always only 1 number in each cell, or sometimes more than one? In this case what to do with the other ones? Are there also numbers in the address? Does the number you're after have a specific format, always the same number of digits? etc.
 
Upvote 0
this UDF will do this, paste it into a VBA module:

Function MyNum(MyString) As Single
'gets numbers from a string e.g. tax (35.5%), returns 355; 34% returns 34
Dim i As Integer
For i = 1 To Len(MyString)
If IsNumeric(Mid(MyString, i, 1)) Then MyNum = MyNum & Mid(MyString, i, 1)
Next i
End Function
then in a blank cell enter:

=mynum(A1)

and just change your cell reference, it will not keep decimals though.

e.g. tax rate = 35.5%

will return 355
 
Upvote 0
Sorry i wasn't more detailed, thank for the UDF Gunswick I'll definitly find a use for that in other problems I have.

The number is always 3 digits e.g 740,046,001,456...etc, and yes there is often other numbers in the address. However, I realised a few minutes ago that all the store numbers where preceeded by an "#", "¬" or "~" so I was able to use text to columns and splice out the number's I needed.
I tried to delete the thread but couldn't seem to delete it. Sorry for the inconvenience.

Thanks for the help though, i will defo use the UDF for something else.
Cheers
Rob
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,458
Members
449,085
Latest member
ExcelError

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top