pick out only the numbers

niladri20052006

Board Regular
Joined
Dec 3, 2010
Messages
121
Hi All,

I have list consisting of Number and Text. Like below

01234ONTP687
2356TR4892
6758OPTYE5689
9252715678 ext1

How will I get only the numbers? I do not want in the cell.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
PLEASE IGNORE MY PREVIOUS POST

Hi All,

I have list consisting of Number and Text. Like below

01234ONTP687
2356TR4892
6758OPTYE5689
9252715678 ext1

How will I get only the numbers? I do not want TEXT in the cell.
 
Upvote 0
(You can edit you posts within 10 minutes or so of posting.)
With something like
01234ONTP687
are you wanting one number (01234687)
or two (01234 and 687)?
 
Upvote 0
Hi

It is only one number in one cell. But there is text in it like below:

1234OPT567

The number is 1234567

I want to Remove OPT from the cell.

I hope you now can understand what exactly I am trying to get.

Let me know if you have any question(s).
 
Upvote 0
A user defined function will be the cleanest way to do this; see if this fits the bill:
Excel Workbook
AB
1001234ONTP68701234687
112356TR489223564892
126758OPTYE568967585689
139252715678 ext192527156781
141.234OPT5671234567
Sheet


Formula in B10 copied down, supported by the code:
Code:
Function NumericOnly(txt As String)
With CreateObject("VBScript.RegExp")
    .Pattern = "[^0-9]"
    .Global = True
    NumericOnly = Trim(.Replace(txt, ""))
End With
End Function
 
Upvote 0
Hi All,

Thanks for your response...

The code is working fine but the formula is not working in my systems.

Thanks a lot to all of you :)
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,679
Members
449,179
Latest member
jacobsscoots

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