Formula to remove text but leave numbers

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
451
Office Version
  1. 365
Platform
  1. Windows
Guys, is there a way to use a formula to remove all text but only leave the numbers (as per example below). Also, remove the zero from the beginning although excel normally does this anyway.

Thanks


[TABLE="class: grid, width: 283"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Tel number[/TD]
[TD]Formula to remove text[/TD]
[/TR]
[TR]
[TD]Mobile: 01234567899[/TD]
[TD="align: right"]1234567899[/TD]
[/TR]
[TR]
[TD]Work: 01234567899[/TD]
[TD="align: right"]1234567899[/TD]
[/TR]
[TR]
[TD]01234567899 mr[/TD]
[TD="align: right"]1234567899[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
with PowerQuery (Get&Transform)

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Tel number[/td][td][/td][td=bgcolor:#70AD47]Numbers[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Mobile: 01234567899[/td][td][/td][td=bgcolor:#E2EFDA]
1234567899​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Work: 01234567899[/td][td][/td][td]
1234567899​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]01234567899 mr[/td][td][/td][td=bgcolor:#E2EFDA]
1234567899​
[/td][/tr]
[/table]


Code:
[SIZE=1]let
    C2R = List.Transform({32..45,47,58..126}, each Character.FromNumber(_)),
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Trim = Table.AddColumn(Source, "Numbers", each Text.Trim([Tel number],C2R)),
    TypeNumber = Table.TransformColumnTypes(Trim,{{"Numbers", type number}}),
    ROC = Table.SelectColumns(TypeNumber,{"Numbers"})
in
    ROC[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,224,932
Messages
6,181,840
Members
453,068
Latest member
DCD1872

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