user3067028
user3067028

Reputation: 159

Combine Vlookups

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

Answers (1)

jstim
jstim

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))

Update for Excel 2007+

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

Related Questions