Index adn match with max and min criteria

Med4040

Board Regular
Joined
Jan 9, 2018
Messages
55
Hello everyone,

I am glad to be here. I need some help with this table please.
I have different lots made on different machines and the corresponding cells are marked x or y

In G6 I need to find out which lot has the largest risk number and smallest potency.
In H6 I need to find out which lot has the largest dose and smallest lot excluding the lot in G6.



For example in G6, lot 1 and lot 2 have highest risk number, then the second criterion should apply (smallest potency of lot 1 and lot 2). The output should be lot 1. Now in H6 formula should exclude lot 1 and look for other lots. So lot 4 and lot 5 have the highest dose and therefore the second criterion should apply (smallest lot size). The output should be lot 4.

I appreciate your help
P.S. I would have uploaded an Excel file but there is no option to upload a file.

Wgu6VrH.png
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You'll need to check if this logic is valid but here's what I came up with. I hope you have MINIFS and MAXIFS ... !


[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G6[/TH]
[TD="align: left"]{=INDEX($B$2:$F$2,MIN(IF($B$5:$F$5=MINIFS($B$5:$F$5,$B6:$F6,"<>",$B$10:$F$10,MAXIFS($B$10:$F$10,$B6:$F6,"<>")),COLUMN($B6:$F6)-COLUMN($B6)+1)))}[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H6[/TH]
[TD="align: left"]{=INDEX($B$2:$F$2,MIN(IF($B$3:$F$3=MINIFS($B$3:$F$3,$B6:$F6,"<>",$B$2:$F$2,"<>"&$G6,$B$4:$F$4,MAXIFS($B$4:$F$4,$B6:$F6,"<>",$B$2:$F$2,"<>"&$G6)),COLUMN($B6:$F6)-COLUMN($B6)+1)))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
WBD

Thanks WBD for your help. The outputs in col G are correct but they are not in col H
 
Upvote 0
Thanks WBD for your help. The outputs in col G are correct but they are not in col H

My apologies WBD. all outputs are correct. I am using Excel 2010. I thank it doesn't have MINIFS and MAXIFS. is there anything compatible with Excel 2010?

Thank you so much.
 
Upvote 0
Thanks so much Marcelo. All outputs are correct except H8. The output should be lot 2 because it has a larger dose (800) than lot 4 (700)

Have you seen post 9?
Repeating: i don't understand why H6 should be Lot 4 (Dose = 700) since Lot 2 has a larger dose (800).

M.
 
Upvote 0
My apologies WBD. all outputs are correct. I am using Excel 2010. I thank it doesn't have MINIFS and MAXIFS. is there anything compatible with Excel 2010?

Thank you so much.

If the results provided by WBD (post 5) are all correct you can try this in Excel 2010


[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[TD="bgcolor: #DCE6F1"]
G
[/TD]
[TD="bgcolor: #DCE6F1"]
H
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD][/TD]
[TD]
lot 1​
[/TD]
[TD]
lot 2​
[/TD]
[TD]
lot 3​
[/TD]
[TD]
lot 4​
[/TD]
[TD]
lot 5​
[/TD]
[TD]
Worst case A​
[/TD]
[TD]
Worst case B​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
lot size​
[/TD]
[TD]
5000​
[/TD]
[TD]
8000​
[/TD]
[TD]
2000​
[/TD]
[TD]
7500​
[/TD]
[TD]
9500​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Dose​
[/TD]
[TD]
800​
[/TD]
[TD]
800​
[/TD]
[TD]
600​
[/TD]
[TD]
700​
[/TD]
[TD]
700​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
Potency​
[/TD]
[TD]
5​
[/TD]
[TD]
10​
[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
2​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
Equipment 1​
[/TD]
[TD]
x​
[/TD]
[TD]
x​
[/TD]
[TD][/TD]
[TD]
x​
[/TD]
[TD]
x​
[/TD]
[TD]
lot 1​
[/TD]
[TD]
lot 2​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD]
Equipment 2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD]
x​
[/TD]
[TD]
x​
[/TD]
[TD]
x​
[/TD]
[TD]
lot 5​
[/TD]
[TD]
lot 4​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD]
Equipment 3​
[/TD]
[TD]
x​
[/TD]
[TD]
x​
[/TD]
[TD][/TD]
[TD]
x​
[/TD]
[TD][/TD]
[TD]
lot 1​
[/TD]
[TD]
lot 2​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD]
Equipment 4​
[/TD]
[TD][/TD]
[TD]
x​
[/TD]
[TD]
y​
[/TD]
[TD][/TD]
[TD]
y​
[/TD]
[TD]
lot 2​
[/TD]
[TD]
lot 5​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD]
Risk Number​
[/TD]
[TD]
90​
[/TD]
[TD]
90​
[/TD]
[TD]
20​
[/TD]
[TD]
20​
[/TD]
[TD]
60​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Array formula in G6 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B6:F6<>"",B$10:F$10-B$5:F$5/1000)),IF(B6:F6<>"",B$10:F$10-B$5:F$5/1000),0))
Ctrl+Shift+Enter

Array formula in H6 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B6:F6<>"",IF(B$2:F$2<>K6,B$4:F$4-B$3:F$3/(10^6)))),IF(B6:F6<>"",IF(B$2:F$2<>K6,B$4:F$4-B$3:F$3/(10^6))),0))
Ctrl+Shift+Enter

M.
 
Last edited:
Upvote 0
Have you seen post 9?
Repeating: i don't understand why H6 should be Lot 4 (Dose = 700) since Lot 2 has a larger dose (800).

M.

I am sorry Marcelo for the confusion. I typed lot 4 in error instead of lot 2. H6 should be lot 2. You are right :)

so the outputs should be:
H6: Lot 2
H7: Lot 4
H8: Lot 2
H8: Lot 5


Thanks Marcelo for modifying WBD's formulas
=INDEX(B$2:F$2,MATCH(MAX(IF(B6:F6<>"",B$10:F$10-B$5:F$5/1000)),IF(B6:F6<>"",B$10:F$10-B$5:F$5/1000),0))
Ctrl+Shift+Enter. This is perfect

Array formula in H6 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B6:F6<>"",IF(B$2:F$2<>K6,B$4:F$4-B$3:F$3/(10^6)))),IF(B6:F6<>"",IF(B$2:F$2<>K6,B$4:F$4-B$3:F$3/(10^6))),0))
Ctrl+Shift+Enter. This gave different outputs.
 
Last edited:
Upvote 0
Sorry my second formula has a typo (i was making tests with first result in K6...)

Correction
H6 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B6:F6<>"",IF(B$2:F$2<>G6,B$4:F$4-B$3:F$3/(10^6)))),IF(B6:F6<>"",IF(B$2:F$2<>G6,B$4:F$4-B$3:F$3/(10^6))),0))
Ctrl+Shift+Enter

M.
 
Last edited:
Upvote 0
Awesome :)
Thank you so much Marcelo. I really appreciate it
Thanks to WBD as well.
You guys are awesome.

Regards,
 
Upvote 0
Thanks Marcelo,

So since the output in G6 is lot 1 (max risk number and lowest potency), lot 1 should be excluded in G6. Then, the remaining lots are lot 2, lot 3, lot 4 and lot 5. The lots with largest dose are lot 4 and lot5 but lot 4 has a smaller lot and therefore, the output should be lot 4.

Nope; the lot with the largest dose is lot 2 so I'm not sure why it's not the answer.

WBD
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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