PDA

View Full Version : PQ - Extracting a number that is a percentage from text



sandy666
03-05-2021, 04:43 AM
(question from the web (https://www.mrexcel.com/board/threads/extracting-a-number-that-is-a-percentage-from-text.1163761/#post-5650898))

I am new to Excel Power Query & love it! Question: does anyone know the formula to use to be able to make a separate column from the example below?
Dewalt Drill Yellow and Black 2.0% hardware store.
Question: How would I create a new column that only has the 2.0% from this text?

srcsrcpercents

Dewalt Drill Yellow and Black 2.0% hardware store.Dewalt Drill Yellow and Black 2.0% hardware store.
2.0%

Kobalt Drill Blue 52.3%Kobalt Drill Blue 52.3%
52.3%

Hitachi Drill Green 6.9%Hitachi Drill Green 6.9%
6.9%


let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
TS = Table.AddColumn(Source, "percents", each Number.FromText(Text.Select([src], {"0".."9"}))/1000)
in
TS
after load query table to the sheet change column percents to Percentage and increase decimal about one place
3532