MIN/MAXIFS function with a criteria that returns multiple correct answers

Mikek1988

New Member
Joined
Oct 7, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I am trying to use some data to find the minimum and maximum values using the MINIFS and MAXIFS function.
However one of my criteria needs to have multiple answers, so the answer of a range could be 'A' or 'B' etc

So far I have got it to return an result for one answer but I also need it to look up other values too as they could be the correct answer instead.

I cannot upload the sheet because it is confidential, any ideas would be greatly appreciated
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
What my equation really needs is a literal 'or' in it so it could be A2orB2orC2 etc but the actual OR function will only return me a true or false answer but I actually need the Minumum number in the range I have selected
 
Upvote 0
Welcome to the MrExcel forum!

Try:

Book1
ABCDEFG
1ValuesCriteria 1Criteria 2Criteria 1Criteria 2Max
21AYesAYes18
32BNoC
43CYesF
54DYes
65EYes
76FYes
87AYes
98BNo
109CNo
1110DYes
1211EYes
1312FYes
1413AYes
1514BYes
1615CNo
1716DNo
1817EYes
1918FYes
20
Sheet24
Cell Formulas
RangeFormula
G2G2=MAX(MAXIFS(A:A,B:B,E2:E4,C:C,F2))
 
Upvote 0
Thanks I will try,

I think the issue is all my data is on one sheet and the table I'm filling in which has the criteria is on another sheet and I cannot add anything to that sheet so I am having to use "???" rather than cells on that sheet
 
Upvote 0
You can hard code the values in the formula, see H2:

Book1
ABCDEFGHI
1ValuesCriteria 1Criteria 2Criteria 1Criteria 2MaxMax v2Max v3
21AYesAYes181818
32BNoC
43CYesF
54DYes
65EYes
76FYes
87AYes
98BNo
109CNo
1110DYes
1211EYes
1312FYes
1413AYes
1514BYes
1615CNo
1716DNo
1817EYes
1918FYes
20
Sheet24
Cell Formulas
RangeFormula
G2G2=MAX(MAXIFS(A:A,B:B,E2:E4,C:C,F2))
H2H2=MAX(MAXIFS(A:A,B:B,{"A","C","F"},C:C,"Yes"))
I2I2=MAX(MAXIFS(A:A,B:B,{"A","C","F"},C:C,{"Yes";"No"}))


Note that with the way Excel works internally, you can only have 2 multiple ranges in an ...IFS function, one horizontal and one vertical. See the I2 formula and how I used semicolons instead of commas in the second array. You can have as many single values as you want.
 
Upvote 0
You can hard code the values in the formula, see H2:

Book1
ABCDEFGHI
1ValuesCriteria 1Criteria 2Criteria 1Criteria 2MaxMax v2Max v3
21AYesAYes181818
32BNoC
43CYesF
54DYes
65EYes
76FYes
87AYes
98BNo
109CNo
1110DYes
1211EYes
1312FYes
1413AYes
1514BYes
1615CNo
1716DNo
1817EYes
1918FYes
20
Sheet24
Cell Formulas
RangeFormula
G2G2=MAX(MAXIFS(A:A,B:B,E2:E4,C:C,F2))
H2H2=MAX(MAXIFS(A:A,B:B,{"A","C","F"},C:C,"Yes"))
I2I2=MAX(MAXIFS(A:A,B:B,{"A","C","F"},C:C,{"Yes";"No"}))


Note that with the way Excel works internally, you can only have 2 multiple ranges in an ...IFS function, one horizontal and one vertical. See the I2 formula and how I used semicolons instead of commas in the second array. You can have as many single values as you want.
Thanks I think H2 might be the solution I didn't know about the curly brackets, what is it exactly that they do?

Everything in my equation has one correct answer except for one criteria which I need to have at least 7 potential answers to check for minimum time
 
Upvote 0
The curly braces define an array constant, or a group of values. Try this experiment. On a blank sheet, put the numbers 1 2 3 4 in A1:B2. Then in another cell, type =A1:B2, but don't hit enter yet. Highlight the A1:B2 part and press F9. That converts it to the value. If you have the US settings, you should see a comma separating columns, and a semicolon separating rows. You can use that same nomenclature in your own formulas directly.

So when you use an array in a formula that normally does not take an array, Excel will calculate the formula 1 time for each entry in the array, giving another array as a result. That's why we need the extra MAX at the front. In my example, it calculates the MAXIFS for "A", then "C", then "F", giving an output array of {13,3,18}, then the outer MAX takes the max value of those. You can see it if you use the Evaluate formula tool.
 
Upvote 0
Ok so in my document my values for A C F it will only find a value for one of them so when I use the curly brackets it will look like {0,12,0} and so will take the answer where it has a positive value and ignore the rest if that is a criteria question, is that right? If so then that's great as long as I can have as many as I want
 
Upvote 0
Yes, it should work for you. Try it out and let me know.
Hi,
I've tried all three of the equations,
In my 2nd column I have multiple locations that I am searching a minimum time against and this is automatically dropping my equation down,
G2 doesn't give me any answers
H2 gives me the results I want but it wants to display the answers in multiple columns for each cell reference within the curly brackets but when I add MIN before the MINIFS it then reverts back to giving me no answers and only the first row filled in but it shows 0
If I change the commas within the curly brackets for semi colons it gives me the minimum time only for the lowest value in the curly brackets but not for each separate row
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

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