How to Compare IDs and Dates in Two Excel Data Sets
Question details
The user wants to compare two sets of data containing IDs and dates to identify if the IDs match, and if so, whether their corresponding dates also match.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Reconciling two lists or tables to find discrepancies in IDs and specific associated dates.
- Observed behavior
- The user needs a formula outcome that outputs three distinct statuses: 'No ID Match', 'ID and Date Match', or 'ID Match and No Date Match'.
Ensure both data sets are formatted consistently, with IDs and dates located in the same respective columns, and verify that the date cells are actually formatted as Dates to avoid false mismatches.
Use Nested IF, COUNTIF, and VLOOKUP Functions
This method is ideal for returning specific text labels detailing exact match statuses: No ID Match, ID and Date Match, or ID Match and No Date Match.
By nesting a VLOOKUP function inside an IF statement, and wrapping that in a COUNTIF check, you can first verify the existence of an ID before comparing its corresponding date. This prevents #N/A errors when an ID is missing.
Ensure Set 1 is located in columns A and B (e.g., A2:B4), and Set 2 begins in columns D and E (e.g., D2:E2).
Click the cell where you want the result to appear (e.g., F2) and type the following formula: =IF(COUNTIF($A$2:$A$4,D2)=0,"No ID Match",IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"ID and Date Match","ID Match and No Date Match")).
Press Enter, then click the fill handle at the bottom right of the cell and drag it down to apply the formula to the remaining rows in your data set.

Use the COUNTIFS Function for Exact Row Matches
If you only need to know whether both the ID and the Date match completely, COUNTIFS provides a simpler and shorter approach.
Easily Compare Complex Data Sets with WPS Spreadsheet
WPS Spreadsheet provides a powerful, user-friendly environment for data reconciliation. You can seamlessly use complex nested formulas like IF, VLOOKUP, and COUNTIFS to compare records with complete compatibility to Microsoft Excel.
- 1. Open your data: Launch WPS Spreadsheet and open the document containing your two data sets.
- 2. Select target cell: Click on the cell next to your second data set where you want the comparison result to display.
- 3. Type the formula: Start typing =IF(COUNTIF... and use the smart autocomplete feature to quickly build your nested formula.
- 4. Drag to fill: Press Enter and double-click the fill handle to automatically compare all IDs and Dates down the list.

Frequently Asked Questions
Why does my VLOOKUP formula return an #N/A error when comparing IDs?
This usually happens if the ID in Set 2 does not exist anywhere in Set 1, or if there is a formatting mismatch (such as one ID formatted as text and the other as a number). Adding the COUNTIF function in the nested formula safely intercepts the #N/A error before VLOOKUP runs.
Can I compare dates without worrying about the specific time format?
Yes. If your date cells contain hidden time stamps that cause false mismatches, you can wrap your cell references in the INT() function (e.g., INT(E2)) inside your formula to extract and compare just the date value.
How do I highlight the mismatched dates automatically?
You can use Conditional Formatting for this. Select your data range, navigate to Home > Conditional Formatting > New Rule, and use a formula like =$F2="ID Match and No Date Match" to apply a custom background color to those specific rows.
Is it possible to compare three or more columns at once?
Absolutely. You can expand the COUNTIFS function to include additional column ranges and criteria, such as =COUNTIFS($A$2:$A$4, D2, $B$2:$B$4, E2, $C$2:$C$4, F2), to evaluate multiple criteria simultaneously.




