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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,713
Messages
6,174,039
Members
452,542
Latest member
Bricklin

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