Max Date Lookup with Multiple Condition Criteria

jws

Board Regular
Joined
Jan 10, 2008
Messages
69
Hello,

I have two tabs on my excel sheet, one is the summary and the other tab is the data tab. I need to find the most recent date for the "State" and "Store" combination where a sale occurred.

Example:

  • PA had a most recent sale on 1/21/13 in Store 20
  • NY had a most recent sale on 1/22/13 in Store 30
  • etc

** The value of the sale does not matter, just that there is a positive sale amount, that is what I am trying to pull into the summary tab.

IXFbN8w.png


Thanks for looking.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
See if this works for you. The solution assumes you have your data in Data!A1:D19 (column headers in row 1), state in column A, store in column B, date in column C, and sales in column D.

Excel 2010
ABCD
1StateStore 20Store 30Store 40
2PA1/21/2013
3NY1/22/2013
4DE1/22/2013
5

<tbody>
</tbody>
Summary

Array Formulas
CellFormula
B2{=MAX(IF(Data!$A$2:$A$19=$A2,IF(Data!$B$2:$B$19=B$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
C2{=MAX(IF(Data!$A$2:$A$19=$A2,IF(Data!$B$2:$B$19=C$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
D2{=MAX(IF(Data!$A$2:$A$19=$A2,IF(Data!$B$2:$B$19=D$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
B3{=MAX(IF(Data!$A$2:$A$19=$A3,IF(Data!$B$2:$B$19=B$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
C3{=MAX(IF(Data!$A$2:$A$19=$A3,IF(Data!$B$2:$B$19=C$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
D3{=MAX(IF(Data!$A$2:$A$19=$A3,IF(Data!$B$2:$B$19=D$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
B4{=MAX(IF(Data!$A$2:$A$19=$A4,IF(Data!$B$2:$B$19=B$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
C4{=MAX(IF(Data!$A$2:$A$19=$A4,IF(Data!$B$2:$B$19=C$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}
D4{=MAX(IF(Data!$A$2:$A$19=$A4,IF(Data!$B$2:$B$19=D$1,IF(Data!$D$2:$D$19>0,Data!$C$2:$C$19))))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Last edited:
Upvote 0
I have been trying to work on this, but my results are not as expected. I am going to continue to try other solutions

thanks
 
Upvote 0
The above solution should work if you have the data set up as earlier described. If the data is set up a bit differently, then the formulas might need some minor tweaking. If you post a sample of your data tab and summary tab information (please do not post any sensitive information), then I can help make the necessary modifications.
 
Upvote 0
The above solution should work if you have the data set up as earlier described. If the data is set up a bit differently, then the formulas might need some minor tweaking. If you post a sample of your data tab and summary tab information (please do not post any sensitive information), then I can help make the necessary modifications.


this solution worked perfectly for me, THANK YOU :).
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

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