A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Use one lookup key that combines article + quantity, then compare that key between the two lists. This avoids false mismatches when the article exists but the quantity differs, or when data types are inconsistent.
Example approach:
- Add a helper column in both tables that joins item and quantity.
- In the ERP table:
=A2&"|"&B2 - In the Master table:
=D2&"|"&E2
- In the ERP table:
- Check whether each ERP row exists in the Master list:
A simpler result-only check is:=IFERROR(XLOOKUP(A2&"|"&B2,$D$2:$D$9&"|"&$E$2:$E$9,$D$2:$D$9,"Not found"),"Not found")=IF(IFERROR(XLOOKUP(A2&"|"&B2,$D$2:$D$9&"|"&$E$2:$E$9,$D$2:$D$9,""),"")="","NOK","OK") - Do the reverse check for the Master rows against ERP:
=IF(IFERROR(XLOOKUP(D2&"|"&E2,$A$2:$A$7&"|"&$B$2:$B$7,$A$2:$A$7,""),"")="","NOK","OK")
If the current formula shows different values even when they look the same, the common causes in Excel are:
- text vs number mismatch
- extra spaces or hidden characters
- incorrect lookup/return ranges
- exact match not actually finding an identical value
To fix that, normalize the data first:
- remove extra spaces with
TRIM() - remove nonprinting characters with
CLEAN() - make sure both sides use the same data type
For example, helper key formulas can be made more robust like this:
=TRIM(A2)&"|"&B2
and
=TRIM(D2)&"|"&E2
If the item numbers are stored as text in one table and as numbers in the other, convert them so both sides match. Excel guidance for lookup errors specifically calls out different data types and hidden spaces as common causes of #N/A or incorrect lookup results.
If #REF! is appearing, that usually indicates the formula is referring to an invalid range or broken reference. Recheck that the lookup array and return array point to valid ranges of matching size.
References: