Removing everything but numbers from cell

jwdemo

Board Regular
Joined
Dec 12, 2013
Messages
188
Office Version
  1. 2013
I have a worksheet and column B has a list of departments and supplier order numbers in it. I'm wanting to get rid of everything but the numbers.
Some examples in these cells are:

Meat:FZN:Retail Ready:160501
Local Meat:Pork:130517
Local Meat:Beef-SweetGrass:110005
Dairy:Food Service:220017


Is there a way to get this done with a macro or a formula in an adjacent column?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Assuming all numbers to be parsed out are always located at the right of the last colon, then power query mcode as follows.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, true), {"Column1.1", "Column1.2"})
in
    #"Split Column by Delimiter"

Book9
AB
1Column1.1Column1.2
2Meat:FZN:Retail Ready160501
3Local Meat:Pork130517
4Local Meat:Beef-SweetGrass110005
5Dairy:Food Service220017
Sheet2
 
Upvote 0
with Power Query

RawNumbers
Meat:FZN:Retail Ready:160501160501
Local Meat:Pork:130517130517
Local Meat:Beef-SweetGrass:110005110005
Dairy:Food Service:220017220017

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Numbers = Table.AddColumn(Source, "Numbers", each Text.Select([Raw],{"0".."9"}))
in
    Numbers
 
Upvote 0
Assuming all numbers to be parsed out are always located at the right of the last colon, then power query mcode as follows.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, true), {"Column1.1", "Column1.2"})
in
    #"Split Column by Delimiter"

Book9
AB
1Column1.1Column1.2
2Meat:FZN:Retail Ready160501
3Local Meat:Pork130517
4Local Meat:Beef-SweetGrass110005
5Dairy:Food Service220017
Sheet2
Thanks! How in the world do I use a "Power Query"?
 
Upvote 0
with Power Query

RawNumbers
Meat:FZN:Retail Ready:160501160501
Local Meat:Pork:130517130517
Local Meat:Beef-SweetGrass:110005110005
Dairy:Food Service:220017220017

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Numbers = Table.AddColumn(Source, "Numbers", each Text.Select([Raw],{"0".."9"}))
in
    Numbers
Thanks! How in the world do I use a "Power Query"?
 
Upvote 0
btw. here is third, different than previous two, approach with Power Query :biggrin: :biggrin: :biggrin:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TAD = Table.AddColumn(Source, "Numbers", each Text.AfterDelimiter([Raw], ":", {0, RelativePosition.FromEnd}), type text)
in
    TAD
RawNumbers
Meat:FZN:Retail Ready:160501160501
Local Meat:Pork:130517130517
Local Meat:Beef-SweetGrass:110005110005
Dairy:Food Service:220017220017

as you can see three different codes but result is the same :cool:
 
Upvote 0
Our GM is a little hestiant about anyone downloading anything...even from Microsoft. Is there a different way to get the same result or is a power query the only answer?
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

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