Power Query Add Column w/ Lookup from a Different Table

gimmeexcel

Board Regular
Joined
May 8, 2009
Messages
95
I have a sheet now where I created a conditional column which required me to enter the data manually. I'd like to be able to this with Power Query grabbing the info from a separate table.
Example Code (Now):

#"XX Create Segments" = Table.AddColumn(#"Sorted Rows", "Segments", each if Text.Contains([Keyword], "service") then "services"
else if Text.Contains([Keyword], "small business") then "small business"
else if Text.Contains([Keyword], "compan") then "companies"
else if Text.Contains([Keyword], "custom") then "custom"
else if Text.Contains([Keyword], "agenc") then "agencies"
else if Text.Contains([Keyword], "professional") then "professional"
else if Text.Contains([Keyword], "firm") then "firms"
else if Text.Contains([Keyword], "commerce") then "e-commerce"
else if Text.Contains([Keyword], "package") then "packages"
else if Text.Contains([Keyword], "redesign") then "redesign"
else if Text.Contains([Keyword], "local") then "local"
else if Text.Contains([Keyword], "consult") then "consulting" else ""),
1. The reference for the PQ is a column named Keywords.
2. From the Keywords column, create new custom column based on the criteria. Name the custom column Segments
3. This is where I need help. I'd like a a way for PQ to get the criteria from a 2 column look table.
4. I'm not sure if there is a way to make it work for compound conditionals. For example if I wanted to include a word (maybe 2) but exclude another word. Perhaps I could set up a 3rd table for words I'd like to exclude?

All help would be greatly appreciated.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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