How to Highlight Excel Cells in Workbook A Based on Workbook B
Question details
The user needs to highlight matching items in multiple daily worksheets (Workbook A) whenever those items appear in a frequently updated reference list in a separate file (Workbook B).

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Comparing and matching data across two different workbooks, where one workbook acts as a dynamic master list and the other contains daily transactional records spread across multiple sheet tabs.
- Observed behavior
- The user wants the formatting in Workbook A to automatically update when the reference list in Workbook B changes, without needing to recreate formatting rules on every daily sheet.
Ensure both Workbook A and Workbook B are open in your spreadsheet application, as conditional formatting rules utilizing cross-workbook formulas often require the source file to be actively open to update successfully.
Apply Conditional Formatting Using COUNTIF
Use the COUNTIF function in a conditional formatting rule to highlight matching values in Workbook A directly referencing the list in Workbook B.
By applying a formula-based conditional formatting rule, you can check if a cell's value exists in an external workbook. Grouping your daily sheets allows you to apply this rule across all of them at once.
In Workbook A, hold the 'Shift' key and click the first and last daily worksheet tabs. This groups the sheets so any formatting applied will affect all of them simultaneously.
Highlight the range of cells where you want the conditional formatting to apply (e.g., A1:A100).
Navigate to the 'Home' tab, click on 'Conditional Formatting', and select 'New Rule'. Choose 'Use a formula to determine which cells to format'.
In the formula box, input =COUNTIF('[Workbook B.xlsx]Sheet1'!$A$1:$A$100, A1)>0. Adjust the file name, sheet name, and ranges to match your exact setup.
Click 'Format', choose a fill color to highlight the matching items, and click 'OK' to apply the rule.

Consolidate Worksheets Using VSTACK and 3-D References
If you need a unified view of all highlighted matches, use VSTACK and 3-D references to pull all daily records from Workbook A into a single master sheet for easy comparison.
Highlight and Compare Cross-Workbook Data with WPS Office
WPS Spreadsheet provides powerful and intuitive tools for cross-workbook referencing, advanced conditional formatting, and 3-D data consolidation. Easily track matching daily records without performance lag.
- 1. Open Both Workbooks: Launch WPS Spreadsheet and open both your daily logs (Workbook A) and reference list (Workbook B).
- 2. Select Target Cells: Group your daily tabs in Workbook A and select the data column you wish to evaluate.
- 3. Access Conditional Formatting: Go to 'Home' > 'Conditional Formatting' > 'New Rule'.
- 4. Apply the Formula: Select 'Use a formula...', input your COUNTIF formula pointing to Workbook B, choose your highlight color, and click 'OK'.

Frequently Asked Questions
Can I use conditional formatting that refers to another workbook?
Yes, you can use formulas like COUNTIF or MATCH in conditional formatting to refer to an external workbook. However, both workbooks usually need to be open simultaneously for the formatting to evaluate and update properly.
Why did my highlights disappear when I closed Workbook B?
Conditional formatting rules containing external references often lose their connection or return an error when the source workbook is closed. To restore the highlights, reopen the source workbook and recalculate the sheets.
What is a 3-D reference in Excel?
A 3-D reference refers to the same cell or range across multiple consecutive worksheets. For example, 'Sheet1:Sheet5'!A1 refers to cell A1 in Sheet1, Sheet2, Sheet3, Sheet4, and Sheet5.
How do I apply conditional formatting to multiple sheets at once?
Hold the Shift key and click the sheet tabs to group them. Then, select the target range and apply your conditional formatting rule. The rule will automatically be applied to the same range in all grouped sheets.




