How to do conditional formatting using a column in another table

ecrodrig

Board Regular
Joined
Jan 21, 2022
Messages
99
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I want to do the following in Power Query (2 different Tables)

If Table 1 Column 1 = Table 2 Column 1 then "yes" else "No"

So basically if the cell in table 1 column 1 has the same information as the cell in Table 2 column 1 then I want it to say yes otherwise no.

I tried doing the following but everything comes out as no when I know it isn't the case:

=Table.AddColumn(#"Replaced Value2", "Custom", each if Table1 [Column 1] = [Column 1] then "it's there" else "not there"


Any help would be greatly appreciated. Thanks.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Power Query:
let
    tbl1 = Excel.CurrentWorkbook(){[Name="FirstTable"]}[Content],
    tbl2 = Excel.CurrentWorkbook(){[Name="SecondTable"]}[Content],
    addIndex = Table.AddIndexColumn(tbl1,"Index"),
    Result = Table.AddColumn(addIndex, "T1 T2 Compare", each if [T1Col1] = tbl2[T2Col1]{[Index]} then "it's there" else "not there")
in
    Result

Book1
ABCDEFGHIJKLMNOPQRST
1T1Col1T1Col2T1Col3T1Col4T1Col5T2Col1T2Col2T2Col3T2Col4T2Col5T1Col1T1Col2T1Col3T1Col4T1Col5IndexT1 T2 Compare
29ZOAF9311844129ZOAF0it's there
37GPMD317365247GPMD1not there
45HRWD5473145HRWD2it's there
56EUIG816422766EUIG3not there
68EXVS7253341328EXVS4not there
72IJFN2192030432IJFN5it's there
81KJTQ63812881KJTQ6not there
94CLBY42921224CLBY7it's there
103HACB1403439263HACB8not there
11
Sheet5
 
Upvote 0
Hi,

Anyway to create this in a custom column? I already have a bunch of statements with in the let and wanted to just be able to create a custom column with the formula. Thanks
 
Upvote 0
Thanks for the info above, I attempted to do this in a custom column and when I create the index I get varing results. Table 2 only has 6 rows and Table 1 has 16 so when I create the index and put 0,0 as I get one "its there" If I do 1, 0 I get a different "Its there" and then if I do 2, 0 yet again a different its there I should see all three its there at the same time.
Hi,

Anyway to create this in a custom column? I already have a bunch of statements with in the let and wanted to just be able to create a custom column with the formula. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,670
Messages
6,173,720
Members
452,528
Latest member
ThomasE

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