BOM comparison - excel function

Dušica Garović 10 Reputation points
2026-08-13T06:58:27.5666667+00:00

I need to check if data from the current BOM ERP(article + quantity) is the same or have some differences from the master file (article + quantity).

I tried to do it with xlookup/if function but every time some error occurs, as it can be visible in the photo 2. For both equal data, function shows that the values are different. I don't know what can be the cause when all the data has the same format. User's image

User's image

Microsoft 365 and Office | Excel | For business | Other
0 comments No comments

6 answers

Sort by: Most helpful
  1. Liora 775 Reputation points Independent Advisor
    2026-08-13T07:33:39.49+00:00

    Dear @Dušica Garović,

    I hope you’re having a good day. 

    Thank you for the screenshots and the additional information.

    Based on what I can see, your approach of creating a combined key such as: **Article & "|" & Quantity**is a reasonable way to compare the ERP BOM against the Master BOM.

    However, from your screenshots, I notice that some values appear visually identical (for example, 2007.0689|1) but still return different results. In situations like this, the issue is often caused by one of the following:

    • Hidden spaces before or after the value.
    • Non-printable characters imported from the ERP system.
    • One side being stored as text while the other is stored as number.
    • Quantity values that look the same due to formatting but differ internally.

    Could you please try the following checks?

    1. Compare the lengths of the two keys
    • For two values that appear identical, use: **=LEN(A2)**and =LEN(B2)
    • If the lengths are different, there is likely an invisible character or extra space.
    1. Clean the values before comparing
    • Try rebuilding the concatenated key using: =TRIM(CLEAN(ArticleCell)) & "|" & TRIM(CLEAN(QtyCell)) and then perform the lookup again.
    1. Check whether Excel sees the values as equal
    • For a pair that appears identical, test: =A2=B2
    • If Excel returns FALSE, then there is some hidden difference in the underlying values.
    1. Verify the lookup formula
    • I also notice a #REF! error in one of the screenshots. This can indicate that the lookup formula is referencing an invalid range or a deleted column. Could you please share the exact formula you are using for the comparison?

    If possible, could you upload a small sample workbook containing a few ERP rows and Master rows that reproduce the issue? That would make it much easier to determine whether the problem is coming from the data itself or from the formula.

      

    I hope this information helps point you in the right direction. If you run into any issues while trying the steps, or if something still doesn’t feel quite right, please don’t hesitate to reach out again. I’ll do my best to support you however I can.   

    Looking forward to hearing back from you with any updates or additional details.  

    Warm regards,  


    If the answer is helpful, please select "Yes" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in the forum documentation to enable email notifications if you want to receive the related email notification for this thread.  

    Was this answer helpful?

    1 person found this answer helpful.

  2. Dušica Garović 10 Reputation points
    2026-08-13T07:13:52.9233333+00:00

    User's image

    I have created additional columns which combine the data - article+quantity. All have format general.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  3. AI answer

    2026-08-13T06:58:57.4433333+00:00

    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:

    1. Add a helper column in both tables that joins item and quantity.
      • In the ERP table:
             =A2&"|"&B2
        
      • In the Master table:
             =D2&"|"&E2
        
    2. Check whether each ERP row exists in the Master list:
         =IFERROR(XLOOKUP(A2&"|"&B2,$D$2:$D$9&"|"&$E$2:$E$9,$D$2:$D$9,"Not found"),"Not found")
      
      A simpler result-only check is:
         =IF(IFERROR(XLOOKUP(A2&"|"&B2,$D$2:$D$9&"|"&$E$2:$E$9,$D$2:$D$9,""),"")="","NOK","OK")
      
    3. 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:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

    1 person found this answer helpful.
  4. TERRENCE KHODANI MUDAU 0 Reputation points
    2026-08-13T08:02:05.5133333+00:00

    that's really fine

    Was this answer helpful?


  5. TERRENCE KHODANI MUDAU 0 Reputation points
    2026-08-13T08:00:48.8533333+00:00

    everything is under control

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.