If two conditions are met, return the smallest value in a range

dportnoy

New Member
Joined
Apr 12, 2022
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Hi.

I have the data below.

ok1.png



My goal is to return the smallest value in the second column if
1. The first column says Student## AND
2. The third column has a 1 in it.

For example, if the range in the first column says "student81" and out of the remaining rows in the array that have both "student81" and the number "1" in the third column, I would to create a formula that will return the smallest value in the second column when those two conditions are met.

So, if student81 is selected as shown in the picture below, the formula would return the number 5 since its the smallest value when 1 is in the third column.


ok2.png



Thank you so much!!!
 

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.
MINIFS()
should work
=MINIFS($C$2:$C$22,$D$2:$D$22,1,$A$2:$A$22,G3)

you have 2016 version so
=MIN(IF(($A$1:$A$22=G3)*($D$1:$D$22=1),$C$1:$C$22))
entered as an array - control + shift + enter

Book1
ABCDEFGHI
1
2Student 111001MINIFSIF(MIN
3Student 222002student 1100100
4Student 33001student 5300300
5Student 41003
6Student 52004
7Student 63001
8Student 72002
9Student 13005
10Student 23001
11Student 33002
12Student 43001
13Student 53001
14Student 64004
15Student 74001
16Student 14002
17Student 24005
18Student 35001
19Student 45001
20Student 55002
21Student 65005
22Student 76001
Sheet2
Cell Formulas
RangeFormula
H3:H4H3=MINIFS($C$2:$C$22,$D$2:$D$22,1,$A$2:$A$22,G3)
I3:I4I3=MIN(IF(($A$1:$A$22=G3)*($D$1:$D$22=1),$C$1:$C$22))
 
Last edited:
Upvote 0
Solution
MINIFS()
should work
=MINIFS($C$2:$C$22,$D$2:$D$22,1,$A$2:$A$22,G3)

you have 2016 version so
=MIN(IF(($A$1:$A$22=G3)*($D$1:$D$22=1),$C$1:$C$22))
entered as an array - control + shift + enter

Book1
ABCDEFGHI
1
2Student 111001MINIFSIF(MIN
3Student 222002student 1100100
4Student 33001student 5300300
5Student 41003
6Student 52004
7Student 63001
8Student 72002
9Student 13005
10Student 23001
11Student 33002
12Student 43001
13Student 53001
14Student 64004
15Student 74001
16Student 14002
17Student 24005
18Student 35001
19Student 45001
20Student 55002
21Student 65005
22Student 76001
Sheet2
Cell Formulas
RangeFormula
H3:H4H3=MINIFS($C$2:$C$22,$D$2:$D$22,1,$A$2:$A$22,G3)
I3:I4I3=MIN(IF(($A$1:$A$22=G3)*($D$1:$D$22=1),$C$1:$C$22))
Thank you! It worked. Is there anyway to get around the Control + Shift + Enter part so the spreadsheet is automatically populated?

Thank you again!
 
Upvote 0
Is there anyway to get around the Control + Shift + Enter part so the spreadsheet is automatically populated?
Not sure what you mean,
control + Shift + Enter
changes the formula to an Array formula and adds { }
Then it acts automatically like any function, providing the settings are set to automatic calculation and NOT set to manual
 
Upvote 0
Thank you! It worked. Is there anyway to get around the Control + Shift + Enter part so the spreadsheet is automatically populated?

Thank you again!
Nevermind, yes that's my bad. I didn't actually attempt populating it down and assumed the #VALUE error would just pop up. Thank you so much again. This was very helpful.
 
Upvote 0
if you want to avoid an Error showing
then you can use an IFERROR()

=IFERROR( MIN(IF(($A$1:$A$22=G3)*($D$1:$D$22=1),$C$1:$C$22)) , "" )
will put a blank in the cell if there is any error
#N/A , #VALUE etc etc
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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