
There are a couple of useful actions that help a lot in cleaning data; removing digits, or keeping digits and removing everything else. In this short blog article, I’ll explain a simple method to do that using Power Query.
Sample Data
My sample data table looks like this:

Removing Digits
I can easily get rid of all digits wherever they are, using this action: adding a custom column:

Then the expression below (remember to use your column name instead of Column1 in the below expression):
Text.Remove(
[Column1],
{"0".."9"}
)
And here is the result;

Digits would be removed regardless of where they are in the text easily using the Text.Remove Power Query Function. And I used a list of digits from zero to nine to have all the range included.
Keeping Digits, Removing Everything Else
If you want to do the opposite of this action, after creating a custom column, you can use the code below;
Text.Remove(
[Column1],
Text.ToList(
Text.Remove(
[Column1],
{"0".."9"}
)
)
)
This is, in fact, the opposite of previous action, it first finds all non digits (similar to the previous process), and then removes them to have only digits. and here is the result:

There are other methods to achieve the same results as well, however, these methods work simple and workable.





nicely done
@Reza – you can use something simpler to Select only Numbers and remove the text
=Text.Select([Column1],{“0”..”9″})
great one Sam. Haven’t worked with Text.Select before. looks great
Cheers
Reza
Hi, is there a way to let the “.” in the numbers?
sure you can. in the list of characters to keep, you can also add “.”
Cheers
Reza