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
 
Sorry for the late reply WBD,

You are absolutely right, the output in H6 is lot 2. I made a typo at the beginning. Please see thread 16.

I really appreciate your help

Regards,
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I encountered this situation where I had to add another row (API) which requires modification of the formula in H7.
Cell H7 displays “lot 2” because it has the max dose and smallest lot size, excluding the product in G7
With the new row I added, H7 should display max dose and smallest lot size, excluding the product in G7 and the API of G7. The output in H7 should be lot 4,
The idea is that G7 and H7 cannot be of the same API.
zmo8y1.png
 
Upvote 0
Maybe...


[Table="class: grid"][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]
API​
[/td][td]
C​
[/td][td]
C​
[/td][td][/td][td]
D​
[/td][td]
E​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/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"]
5
[/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"]
6
[/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"]
7
[/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 4​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/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"]
9
[/td][td]
Equipment 3​
[/td][td]
x​
[/td][td]
x​
[/td][td][/td][td]
x​
[/td][td][/td][td]
lot 1​
[/td][td]
lot 4​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/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"]
11
[/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]
[/table]


Array formula in G7 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B7:F7<>"",B$11:F$11-B$6:F$6/1000)),IF(B7:F7<>"",B$11:F$11-B$6:F$6/1000),0))
Ctrl+Shift+Enter

Array formula in H7 copied down
=INDEX(B$2:F$2,MATCH(MAX(IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$5:F$5-B$4:F$4/(10^6)))),IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$5:F$5-B$4:F$4/(10^6))),0))
Ctrl+Shift+Enter

M.
 
Upvote 0
Hi again Marcelo,

I need to make new criteria for product B in H7. It should be the lowest value in row 12 (lot size/ Dose) excluding the product an API in G7
I couldn't modify your last formula to this criteria as it resulted in different results. When you get a chance, can you please look at it.

Thank you so much

INDEX(B$2:F$2,MATCH(MAX(IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$5:F$5-B$4:F$4/(10^6)))),IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$5:F$5-B$4:F$4/(10^6))),0))

2agq7hc.jpg
[/IMG]
 
Upvote 0
Try

H7 copied down
=INDEX(B$2:F$2,MATCH(MIN(IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$12:F$12))),IF(B7:F7<>"",IF(B$3:F$3<>INDEX(B$3:F$3,MATCH(G7,B$2:F$2,0)),B$12:F$12)),0))
Ctrl+Shift+Enter

M.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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