Multi-conditions for Value Lookup

sunnyrainy

New Member
Joined
Apr 13, 2022
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hi, I have been searching a solution here but can't seem to find a fit. Much much grateful if you can help figure out the formula/macro/other automation:

Scenario 1

Sheet 1: Same ID can have different rows of Start Date/End Date and Location Code
Capture1.PNG


Sheet 2: Would like to lookup the Location Code from sheet 1 based on the Product ID AND Sell Date that falls within the Start Date-End Date
Example:
-Product ID: 123456-1 with Sell Date: 17-03-2017
-Fall into Sheet 1 date B1-C3
-Return Location Code as sheet 1 D2
Capture2.PNG


Scenario 2: Added an extra condition

Sheet 1: Same ID can have different rows of Start Date/End Date/ Location Code and Quality Check Status
1649905037381.png


Sheet 2: Would like to lookup the Location Code from sheet 1 based on the Product ID AND Sell Date that falls within the Start Date-End Date AND Quality Check as "Y"
Example:
-Product ID: 123456-1 with Sell Date: 17-03-2017
-Fall into Sheet 1 both dates B1-C3 / C3-D3
-Fulfill condition: Quality Check "Y" i.e. B2
-Return Location Code as sheet 1 E2 instead of E3
1649905118568.png


Thank you!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
sheet2 C2:
Scen 1:
Code:
=IFERROR(LOOKUP(2,1/(Sheet1!$A$2:$A$7=A2)/(Sheet1!$B$2:$B$7<=B2)/(Sheet1!$C$2:$C$7>=B2),Sheet1!$D$2:$D$7),"")

Scen 2:
Code:
=IFERROR(LOOKUP(2,1/(Sheet1!$A$2:$A$7=A2)/(Sheet1!$B$2:$B$7="Y")/(Sheet1!$C$2:$C$7<=B2)/(Sheet1!$D$2:$D$7>=B2),Sheet1!$E$2:$E$7),"")
 
Upvote 0
sheet2 C2:
Scen 1:
Code:
=IFERROR(LOOKUP(2,1/(Sheet1!$A$2:$A$7=A2)/(Sheet1!$B$2:$B$7<=B2)/(Sheet1!$C$2:$C$7>=B2),Sheet1!$D$2:$D$7),"")

Scen 2:
Code:
=IFERROR(LOOKUP(2,1/(Sheet1!$A$2:$A$7=A2)/(Sheet1!$B$2:$B$7="Y")/(Sheet1!$C$2:$C$7<=B2)/(Sheet1!$D$2:$D$7>=B2),Sheet1!$E$2:$E$7),"")
Sorry I tried but no any value of Location Code returns. Could you please further advise?
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,043
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top