Return the max value considering criteria in multiple columns

Harry_

New Member
Joined
Jan 9, 2014
Messages
1
I would like to return the value in column D (Store Name) that corresponds to the Max value in column N (Units Still Required). However, this Max value must meet certain criteria. That is, the State (column J) and Style Code (column Q) must be the same as that of the row being considered.

I have tried the below formula, and it appears to work the majority of the time, however, occassionally it does not adhere to the criteria (i.e. same State and Style Code).

For example in cell M7:
=IF(L7=0," ",INDEX(D$7:D$999,MATCH(MAX((IF((J:J=J7)*(Q:Q=Q7),N:N))),N$7:N$999,0)))
CTRL + SHIFT + ENTER


- -

Can anyone reccommend an alternate formula that will not falter where mine does?

Below is a snapshot of my Data, if that helps.



Style CodeStateLocation CodeLocation NameDescMaxCurrent OHLast X Weeks SalesSum of W OHStateRequiredAvailableSend ToUnits Still RequiredNew OH UnitsDifferenceStyle Code
1000044573NSW0009GP MacquarieFARAH SHORT BOOT BLACK410NSW1GP Bondi Junction101000044573
0021GP ChatswoodFARAH SHORT BOOT BLACK450NSW5501000044573
0032GP Castle HillFARAH SHORT BOOT BLACK400NSW0001000044573
0034GP Macarthur SquareFARAH SHORT BOOT BLACK5010NSW505001000044573
0039GP BurwoodFARAH SHORT BOOT BLACK540NSW4401000044573
0040GP HornsbyFARAH SHORT BOOT BLACK430NSW3301000044573
0043GP ErinaFARAH SHORT BOOT BLACK6010NSW606001000044573
0045GP Bondi JunctionFARAH SHORT BOOT BLACK8010NSW807111000044573

<tbody>
</tbody>
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
It's a hard task to match the formula you posted to your exhibit.

Z7, ontrol+shift+enter and copy down:
Rich (BB code):
=IFERROR(INDEX(D$7:D$999,SMALL(IF(J$7:J$999=State,IF(Q$7:Q$999=StyleCode,
  IF(N$7:N$999=MAX(IF(J$7:J$999=State,IF(Q$7:Q$999=StyleCode,N$7:N$999))),
  ROW(D$7:D$999)-ROW(D$7)+1))),ROWS(Z$7:Z7))),"")
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,743
Members
449,094
Latest member
dsharae57

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