Reputation: 159
I'm trying to combine two vlookup statements. Here is what I have:
=VLOOKUP(C2,'Purchase Order Browse'!$Q$4:$R$65,2)
What I want it to do if it doesn't find anything above is to then do a vlookup on this data set
=VLOOKUP(C2,'Work Order Browse'!M4:N123,2)
How do I combine the two to work together?
Upvotes: 0
Views: 5465
Reputation: 2432
If a VLOOKUP does not find a match, it should return #N/A
, so you could add it into an IF
statement.
=IF(ISNA(VLOOKUP(C2,'Purchase Order Browse'!$Q$4:$R$65,2)), VLOOKUP(C2,'Work Order Browse'!M4:N123,2), VLOOKUP(C2,'Purchase Order Browse'!$Q$4:$R$65,2))
As pointed out by barry houdini, Excel 2007 and later supports an IFERROR
function that takes two params IFERROR(value, value_if_error)
:
IFERROR function returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula.
=IFERROR(VLOOKUP(C2,'Purchase Order Browse'!$Q$4:$R$65,2), VLOOKUP(C2,'Work Order Browse'!M4:N123,2))
Upvotes: 3