How to Use Excel COUNTIF to Find Missing Values Across Workbooks
Question details
Identify values missing from a column in one workbook by comparing it with a reference column in another workbook, potentially across multiple worksheets.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Comparing data columns between two separate workbooks to find discrepancies or locate missing records.
- Observed behavior
- The user requires a formula-based solution that outputs a zero or specific flag when a searched value does not exist in the external reference dataset.
Before starting, ensure both workbooks are open and check that the columns being compared have identical formatting (e.g., both formatted as Text) to prevent false mismatch errors.
Consolidate Data and Use the COUNTIF Function
The most reliable method to compare values across workbooks is to bring the reference data into the target workbook as a new sheet, then apply the COUNTIF function.
Referencing external workbooks with formulas can lead to broken links or update errors when files are closed or moved. By copying the reference data directly into your primary workbook, the COUNTIF formula will function reliably across all your worksheets.
Open the second workbook, select the entire column containing your reference data, and press Ctrl+C to copy it. Switch to your first workbook, click the '+' icon to create a new worksheet, name it 'Column', and press Ctrl+V to paste the data.
If you are checking multiple worksheets, create another new sheet named 'Summary'. Add headers such as 'Sheet Name' and 'Missing Value' in row 1 to organize your findings.
In your target worksheet, click the empty cell next to the first value you want to check (e.g., B2). Enter the formula =COUNTIF(Column!A:A, A2) and press Enter. Double-click the fill handle in the bottom-right corner of the cell to drag the formula down the entire column.
Go to the 'Data' tab and click 'Filter'. Click the dropdown arrow on your formula column and uncheck everything except '0'. The remaining visible rows represent the missing values.

Compare Data Across Sheets Easily with WPS Spreadsheet
WPS Spreadsheet fully supports the COUNTIF function and features an intuitive tabbed interface, making it incredibly simple to copy reference columns and compare data across multiple workbooks in a single window.
- 1. Open both workbooks: Launch WPS Spreadsheet and open your source and target workbooks. They will appear as neat tabs in the same window.
- 2. Copy reference data: Highlight the reference column in the source workbook, copy it, and paste it into a new sheet named 'Column' in your target workbook.
- 3. Insert the function: Select the cell adjacent to your target data and input the formula =COUNTIF(Column!A:A, A2).
- 4. Filter the results: Drag the formula down to apply it to all rows, then use the Data > Filter tool to display only the rows returning '0', indicating missing data.

Frequently Asked Questions
Can I use COUNTIF directly on a closed external workbook?
While you can write a COUNTIF formula referencing another workbook (e.g., =COUNTIF('[Workbook2.xlsx]Sheet1'!$A:$A, A2)), the COUNTIF function requires the external workbook to be open to update properly. If it is closed, the formula may return a #VALUE! error.
Why does my COUNTIF formula return 0 when the value is visually in the reference column?
This is typically caused by mismatched data formats or hidden spaces. Ensure both columns are formatted identically (either both as Text or both as Numbers). You can use the TRIM function to remove any accidental leading or trailing spaces from your data.
Is there a better function than COUNTIF for finding missing Excel values?
COUNTIF is excellent for simple existence checks. However, VLOOKUP or XLOOKUP are also highly effective. If you use VLOOKUP to search for a value and it returns an #N/A error, that directly indicates the value is missing from the reference column.




