agentfl
agentfl

Reputation: 13

Use OR in vlookup Table Array

Is it possible to write a vlookup to point to one worksheet or another?

I have a master spreadsheet that points to a weekly spreadsheet via vlookup. Sometimes the sheet name will be called "SKU" and other times "Sales by sku".

The sheet name is the only part that changes. The cell ranges i point to will be the same for both circumstances.

Can i write a vlookup to point to one sheet if not point to the other?

My current vlookup:

=VLOOKUP(A2,'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]SKU'!$D$1:$G$65536,4,FALSE)

I want something like:

[Current BSL, Branch Stock, Whouse Stock, On Order.xls]SKU OR Sales by sku'!$D$1:$G$65536,4,FALSE)

Thanks

Upvotes: 1

Views: 82

Answers (2)

Dirk Reichel
Dirk Reichel

Reputation: 7979

IFERROR sould be enough in this case:

=IFERROR(VLOOKUP(A2,'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]Sales by sku'!$D$1:$G$65536,4,FALSE),VLOOKUP(A2,'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]SKU'!$D$1:$G$65536,4,FALSE))

EDIT

Merged with INDIRECT it should look like this:

=IFERROR(VLOOKUP(A2,INDIRECT("'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]Sales by sku'!$D$1:$G$65536",1),4,FALSE),VLOOKUP(A2,INDIRECT("'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]SKU'!$D$1:$G$65536",1),4,FALSE))

Upvotes: 4

D_Bester
D_Bester

Reputation: 5921

Use Indirect(If(<logic here>,"'...OTC\2016\Reports Sent\[Current BSL, Branch Stock, Whouse Stock, On Order.xls]SKU'!$D$1:$G$65536","second address")

Upvotes: 0

Related Questions