Search code examples
excelexcel-formulavlookup

Add between two VLOOKUP


I am trying to add 2 VLOOKUP together but when it does not find the target, it gives me an error.

=Vlookup(A1, 'TestA'!A1:B5, 5, 0) + Vlookup(A1, 'TestB'!A1:B5, 5, 0) + 1

The issue is that when either (or both) Vlookup are not found, it gives an error #N/A instead of just displaying the answer "1".

I am trying to look for an answer but most of the answers are regarding issues between adding VLOOKUP from 2 different sheets and not regarding my specific issue.

Thanks in advance.


Solution

  • Add IfNA function:

    =IfNA(Vlookup(A1, 'TestA'!A1:B5, 5, 0),0) + IfNA(Vlookup(A1, 'TestB'!A1:B5, 5, 0),0) + 1