Custom Column Power Query

Quiquegl

New Member
Joined
Mar 26, 2013
Messages
9
I want to create a custom column that returns me the value of another column cell if the text contains a specific word.

If the text doesn't contain the word I am looking for, then return null.

What would be the IF statement in Power Query?

Example:
Column Name: Office
Account: 640.000011 Expatiate
Office: BR Brussels
Department: AD
Office: SU Seoul

Desired Result: Insert a new column that shows only rows values like "Office: BR Brussels" and Office: SU Seoul, the rest of column values are nulls.
.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You can do this using the 'Conditional Column' button in the 'Add Column' tab of Power Query. A window will let you select what conditions are to be met and what are the desired results if the condition is met or otherwise.

The code would be:
Code:
    Table.AddColumn( 
        Source, 
        "Custom", 
        each 
            if Text.StartsWith([Columna1], "Office:") 
            then [Columna1] 
            else null 
    )
To fo from the blue table to the green.

Excel 2016 (Windows) 64 bit
Columna1Columna1Custom
Example:Example:
Column Name: OfficeColumn Name: Office
Account: 640.000011 ExpatiateAccount: 640.000011 Expatiate
Office: BR BrusselsOffice: BR BrusselsOffice: BR Brussels
Department: ADDepartment: AD
Office: SU SeoulOffice: SU SeoulOffice: SU Seoul

<tbody>
</tbody>
 
Upvote 0
Thank you FranzV. I don't see 'Conditional Column' button, probably because I am using Excel 2010 at my firm. I will test it from home.
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,442
Members
448,898
Latest member
drewmorgan128

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