ISO formula to remove spaces and/or dashes from a column of numbers

paquirl

Board Regular
Joined
Oct 12, 2010
Messages
226
Office Version
  1. 2016
Platform
  1. Windows
I have a column with numbers where the user has separated portions with space(s) or a dash. Need a formula to remove them.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Like this?

Book2
AB
1NumberNo separators
211
355
4123-4512345
5123 4512345
6999-123-45679991234567
Sheet3
Cell Formulas
RangeFormula
B2:B6B2=SUBSTITUTE(SUBSTITUTE(A2," ",""),"-","")


Keep in mind that the result is a number stored as text, not a numeric value.
 
Upvote 0
Solution
Hi it is not working for me. I'm wondering if it is because i told you wrong, it's not numbers. My info is stored as text this time. I get different formats sent to me depending on the day.
 
Upvote 0
this works, the spreadsheet i have today was protected. this solution does work thank you
 
Upvote 0
rawResult
41-49 060 AB-C4149060ABC
X C-144 08 067XC14408067
167-37-67-416737674
1 50 83-55 315083553
4 87 76-20-748776207

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TS = Table.AddColumn(Source, "Result", each Text.Select([raw],{"0".."9","a".."z","A".."Z"})),
    RC = Table.RemoveColumns(TS,{"raw"})
in
    RC
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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