Sometimes we list all products/students or other objects information in one workbook, but list part of them into another workbook based on some criteria. For example, we list all student’s information into workbook Book1 Sheet-All, and list the students who pass the exam in Book2 Sheet-Pass. If we want to lookup students in Book1 refer to the list in Book2, we can apply conditional formatting function to mark these students with proper format.
Table1 in Book1 Sheet-All.
Table2 in Book2 Sheet-Pass.
Now, we want to find out matched values in table1 based on values in table2.
Method: Apply Conditional Formatting across Workbook
Step 1: In this step, you can copy table2 from Book2 to Book1 Sheet-All just next to table1. Or you can type the formula ='[Book2.xlsx]Sheet-Pass’!A2 into any cell next to table1 to get values from Book2 table2. Drag fill handle down till 0 displays.
Now all names exist in table2 from another workbook/worksheet are copied into current workbook/worksheet.
Step 2: Select table1, this table is the range we want to apply conditional formatting function. Click Home in ribbon, then click Conditional Formatting in Styles group, select New Rule in menu.
Step 3: On New Formatting Rule dialog, select the last rule type: Use a formula to determine which cells to format.
Step 4: In Edit the Rule Description section, in Format values where this formula is true textbox, enter this formula =COUNTIF($E$2:$E$4,$B2)>0. In this formula, $E$2:$E$4 is the range you refer to from table2 (just copied to current worksheet), $B2 is the first name you want to look up from another workbook.
Step 5: Click Format button in Preview section. Verify that Format Cells window is displayed.
Step 6: Click Fill tab, then select a color as background color. For example, select yellow, then click OK.
Step 7: After above step, we go back to New Formatting Rule window. You can see that in Preview section, cell is filled with yellow. Click OK.
Step 8: After above all steps, check table1. Verify that matched values are marked with yellow properly.