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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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 !!...:beerchug:
 
Upvote 0

Forum statistics

Threads
1,222,122
Messages
6,164,084
Members
451,872
Latest member
TimothyLynn

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