Array formula MIN/MAX NESTED IF STATEMENT

Joined
Jul 15, 2015
Messages
7
Hi everyone,

Im having issues with a formula. I want it to be a nested if statement, so that if it says "start" then use the min formula and if it says "Stop" use max. I also want it in array format, and it was working when I had them separated (using min for start and max for stop in different formulas) but I want it all together.

This is what I have right now and I know doesn't work:
=IF(G2="Start",MIN(IF('Raw Data'!$B:$B=Sheet1!H$1,IF('Raw Data'!$A:$A=$B2,'Raw Data'!$C:$C))),IF(G2="Stop",MAX(IF('Raw Data'!$B:$B=Sheet1!H$1,IF('Raw Data'!$A:$A=Sheet1!$B107,'Raw Data'!$H:$H)))))

This worked before:

{=MAX(IF('Raw Data'!$B:$B=Sheet1!H$1,IF('Raw Data'!$A:$A=Sheet1!$B107,'Raw Data'!$H:$H)))}

and

{=MIN(IF('Raw Data'!$B:$B=Sheet1!H$1,IF('Raw Data'!$A:$A=Sheet1!$B53,'Raw Data'!$C:$C)))}

in two separate rows.

I want these two together and use MIN if it says start on the column next to it and use the MAX one if it says stop.

Hope someone is able to help me! Thank you!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210

Control+shift+enter, not just enter:

=IF(G2="Start",MIN(IF('Raw Data'!$B:$B=H$1,IF('Raw Data'!$A:$A=$B2,'Raw Data'!$C:$C))),IF(G2="Stop",MAX(IF('Raw Data'!$B:$B=H$1,IF('Raw Data'!$A:$A=$B107,'Raw Data'!$H:$H)))))

should work as intended. Try to avoid referencing whole columns in array-processing formulas like this one for reasons of efficiency.
 
Joined
Jul 15, 2015
Messages
7
Control+shift+enter, not just enter:

=IF(G2="Start",MIN(IF('Raw Data'!$B:$B=H$1,IF('Raw Data'!$A:$A=$B2,'Raw Data'!$C:$C))),IF(G2="Stop",MAX(IF('Raw Data'!$B:$B=H$1,IF('Raw Data'!$A:$A=$B107,'Raw Data'!$H:$H)))))

should work as intended. Try to avoid referencing whole columns in array-processing formulas like this one for reasons of efficiency.


Aladin, it gives me back FALSE all across.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,309
Messages
5,836,574
Members
430,438
Latest member
David Gr

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
Top