Return only numbers in a cell

marshy3300

Board Regular
Joined
Aug 17, 2014
Messages
59
Hi Pros and Hacks alike,

I have cells that contain both #s and characters but only ant the numbers (sort of)
EG.

E3= 1415 x 1455
E4= 1400* x 1460
E5= 1460mm x 1460mm
E6= 1455w x 1780L

Basically i want it only to show as "####" x "####"

Any help would be awesome
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
How about a UDF
Copy this into a Standard Module
Code:
Function num(ByVal txt As String) As String
Dim X As Long     'Code base by Rick Rothstein (MVP - Excel)
    For X = 1 To Len(txt)
        If Mid(txt, X, 1) Like "*[!0-9 x ]*" Then Mid(txt, X, 1) = Chr(1)
    Next
num = Replace(txt, Chr(1), "")
End Function

Then use the formula as follows



Excel 2010
EF
21415 x 14551415 x 1455
31400* x 14601400 x 1460
41460mm x 1460mm1460 x 1460
51455w x 1780L1455 x 1780
Sheet3
Cell Formulas
RangeFormula
F2=num(E2)
F3=num(E3)
F4=num(E4)
F5=num(E5)
 
Upvote 0
Glad it worked, and thanks for the feedback......you'll note in the code though that one of our other posters Rick Rothstein is the brilliant one !!...(y)
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,656
Members
449,045
Latest member
Marcus05

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