Multiple Criteria Lookup with dates

NikShah

New Member
Joined
Jul 11, 2011
Messages
10
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hello,

My query is that I would like to use Index and Match functions that relate to the Date and Code criteria as per query below. It can be assumed that the data box below starts from cell A1 to C8 and the criteria box from E1 to G8. The formula I have been using is the following: {=INDEX(C:C,MATCH(1,IF(A:A=E3,IF(B:B=F3,1)),0))*-1}, but for months 201401 and 201312 is retrieving an error. Ideally if there is no such date as 201312 or 201401 I would like to have a lookup that references the previous date available - in this case 201311 - which should retrieve the price of 160.

I have tried to amend the formula above to {=INDEX(C:C,MATCH(1,IF(A:A<=E3,IF(B:B=F3,1)),0))*-1}, but then it retrieves the price for 201310 which is 164.

Can anyone please help?

Regards,
Nik.

DataCriteriaResult
DateCodePriceDateCodePrice
201310D&D T1-24PM17X164201402D&D T1-24PM17X-154
201311D&D T1-24PM17X160201403D&D T1-24PM17X-150
201402D&D T1-24PM17X154201401D&D T1-24PM17X#N/A
201403D&D T1-24PM17X150201405D&D T1-24PM17X-145
201405D&D T1-24PM17X145201406D&D T1-24PM17X-140
201406D&D T1-24PM17X140201312D&D T1-24PM17X#N/A

<tbody>
</tbody><colgroup><col><col><col><col><col><col><col></colgroup>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Would you post the desired results instead of the results of a non-working formula?

Yes sure. The desired results are as such:

DataCriteriaResult
DateCodePriceDateCodePrice
201310D&D T1-24PM17X164201402D&D T1-24PM17X-154
201311D&D T1-24PM17X160201403D&D T1-24PM17X-150
201402D&D T1-24PM17X154201401D&D T1-24PM17X-160
201403D&D T1-24PM17X150201405D&D T1-24PM17X-145
201405D&D T1-24PM17X145201406D&D T1-24PM17X-140
201406D&D T1-24PM17X140201312D&D T1-24PM17X-160

<tbody>
</tbody>
 
Upvote 0
Yes sure. The desired results are as such:

DataCriteriaResult
DateCodePriceDateCodePrice
201310D&D T1-24PM17X164201402D&D T1-24PM17X-154
201311D&D T1-24PM17X160201403D&D T1-24PM17X-150
201402D&D T1-24PM17X154201401D&D T1-24PM17X-160
201403D&D T1-24PM17X150201405D&D T1-24PM17X-145
201405D&D T1-24PM17X145201406D&D T1-24PM17X-140
201406D&D T1-24PM17X140201312D&D T1-24PM17X-160

<tbody>
</tbody>

Thanks for the sample and the associated desired results.

In G3 control+shift+enter, not just enter, and copy down:

=-1*INDEX($C$3:$C$8,MAX(IF($A$3:$A$8<=E3,IF($B$3:$B$8=F3,ROW($C$3:$C$8)-ROW($C$3)+1))))
 
Upvote 0
Thanks for the sample and the associated desired results.

In G3 control+shift+enter, not just enter, and copy down:

=-1*INDEX($C$3:$C$8,MAX(IF($A$3:$A$8<=E3,IF($B$3:$B$8=F3,ROW($C$3:$C$8)-ROW($C$3)+1))))


That's brilliant! Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,258
Members
449,149
Latest member
mwdbActuary

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