Power Query Text Wildcard condition

Taf

New Member
Joined
May 2, 2003
Messages
49
How can I convert the below formula into a power Query Custom Column

Excel Formula:
=IF(ISNUMBER(SEARCH("?0*",[Term])),0,LEN(TRIM([Term]))-LEN(SUBSTITUTE([Term]," ",""))+1)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try this for the formula in your custom column:

Power Query:
if Text.Length(Text.BeforeDelimiter([Term],"0",0)) = 1 then 0 else Text.Length([Term])-Text.Length(Text.Replace([Term]," ",""))+1

PQ does not support use of wildcards so you kind of have to maneuver around that with the existing Text. functions: If the length of the text before the first instance of "0" is 1, then apply your logic.
 
Upvote 0
Solution
Try this for the formula in your custom column:

Power Query:
if Text.Length(Text.BeforeDelimiter([Term],"0",0)) = 1 then 0 else Text.Length([Term])-Text.Length(Text.Replace([Term]," ",""))+1

PQ does not support use of wildcards so you kind of have to maneuver around that with the existing Text. functions: If the length of the text before the first instance of "0" is 1, then apply your logic.
This is perfect. Thank you. I am kind of new in the Pivot Table / Power Query world.
 
Upvote 0

Forum statistics

Threads
1,225,608
Messages
6,185,963
Members
453,333
Latest member
BioCoder84

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