Power Query - Use betwen delimiter only if entire column has it

MasterBash

Board Regular
Joined
Jan 22, 2022
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Hi,

So I want to use a delimiter to pull what is between parenthesis (). However, the condition of using the delimiter is that the entire column (all the rows in that column) must have the rounded brackets.

Name :Expected result :
This is a (product) nameproduct
Here is (another product) nameanother product
I am (giving a third) examplegiving a third
This is the fourth (example)example

However, if all rows do not have the delimiter, then do not use the delimiter :

Name :Expected result :
This is a product nameThis is a product name
This is (another product) nameThis is (another product) name
I am (giving a third) exampleI am (giving a third) example
This is the fourth exampleThis is the fourth example

How can I accomplish that ?

Thank you.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    result = Table.TransformColumns(Source, {"Name", each if Table.RowCount(Source) = List.Count(List.Select(Source[Name], (x)=> Text.Contains(x,"(") and Text.Contains(x,")"))) then Text.BetweenDelimiters(_,"(",")") else _})  
in
    result
 
Upvote 1
Solution

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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