top of page
9d657493-a904-48e4-b46b-e08acb544ddf.png

POSTS

Power Query: Extract Numbers from a Text String

Updated: Feb 24



PRACTICE MATERIAL BELOW!👇

Function: Extracts only the numeric values from a given text. Simply add custom function in Power Query and define your column.


Power Query editor interface showing a code script titled Query1 with text editor on the right; toolbar and navigation pane on the left.
Add a new Query from Sources


Usage:

 = ExtractNumbers("Order ID: 123ABC456") → Returns: "123456"

Power Query code for use and reuse:

let

ExtractNumbers = (inputText as nullable text) as nullable text =>

let

NumbersOnly =

if inputText = null then null

else Text.Select(inputText, {"0".."9"})

in

NumbersOnly

in

ExtractNumbers



Spreadsheet software with "Add Column" tab highlighted. A data table shows columns like "Valid" and "Error" with percentages. Query1 is selected.
Choose your column with a text/number to clean (to extract just numbers)


Need a code and instructions? Free of charge =)




Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
logo

Transform your data with our data analytics services! From Excel to Power BI with Power Query in the background, drive your business forward!

  • Linkedin
  • Xing
  • RSS
  • 4844455

Contact Us

Address:
83022 Rosenheim, Bavaria, Germany
Worldwide (online) available!

Join Us!

Stay updated with tips & tutorials!

© Excelized. All rights reserved.

bottom of page