# MIFS with complex COUNTIF formula inside

#### Leticia

##### New Member
Hi! I am trying to find the oldest date in KPI!\$G:\$G meeting all the conditions of either these two formulas (I obtained the same result)

- COUNTIFS(KPI!\$P:\$P;"PENDIENTE";KPI!\$G:\$G;"<="&\$F\$4)+COUNTIFS(KPI!\$G:\$G;"<="&\$F\$4;KPI!\$Q:\$Q;">"&\$F\$4)-IFERROR(IFS(\$G\$4="YES";SUM(COUNTIFS(KPI!\$R:\$R;{"R.";"7250"};KPI!\$G:\$G;"<="&\$F\$4;KPI!\$Q:\$Q;">"&\$F\$4;KPI!\$Q:\$Q;"<"&\$F\$4+30)));0)
- IF(\$G\$4="YES";COUNTIFS(KPI!\$P:\$P;"PENDIENTE";KPI!\$G:\$G;"<="&\$F\$4)+COUNTIFS(KPI!\$G:\$G;"<="&\$F\$4;KPI!\$Q:\$Q;">"&\$F\$4)-SUM(COUNTIFS(KPI!\$R:\$R;{"R.";"7250"};KPI!\$G:\$G;"<="&\$F\$4;KPI!\$Q:\$Q;">"&\$F\$4;KPI!\$Q:\$Q;"<"&\$F\$4+30));COUNTIFS(KPI!\$P:\$P;"PENDIENTE";KPI!\$G:\$G;"<="&\$F\$4)+COUNTIFS(KPI!\$G:\$G;"<="&\$F\$4;KPI!\$Q:\$Q;">"&\$F\$4))

Thank you!

### Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

minisheet pls.

#### Leticia

##### New Member
minisheet pls.

Hi! I dont know why it does not let me extract the minisheet.
but here it would be simplified. THANK YOU!

=IF(\$G\$4="YES";COUNTIFS('EV80'!\$C:\$C;"PENDIENTE";'EV80'!\$B:\$B;"<="&\$F\$4)+COUNTIFS('EV80'!\$B:\$B;"<="&\$F\$4;'EV80'!\$D:\$D;">"&\$F\$4)-SUM(COUNTIFS('EV80'!\$E:\$E;{"R.";"7250"};'EV80'!\$B:\$B;"<="&\$F\$4;'EV80'!\$D:\$D;">"&\$F\$4;'EV80'!\$D:\$D;"<"&\$F\$4+30));COUNTIFS('EV80'!\$C:\$C;"PENDIENTE";'EV80'!\$B:\$B;"<="&\$F\$4)+COUNTIFS('EV80'!\$B:\$B;"<="&\$F\$4;'EV80'!\$D:\$D;">"&\$F\$4))

#### Leticia

##### New Member
minisheet pls.
=IF(\$G\$4="YES";MIN(MINIFS('EV80'!\$G:\$G;'EV80'!\$P:\$P;"PENDIENTE";'EV80'!\$G:\$G;"<="&\$F\$4);MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4);IF(\$G\$4="YES";MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4;'EV80'!\$Q:\$Q;"<"&\$F\$4+30;'EV80'!\$R:\$R;"R.");"");IF(\$G\$4="YES";MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4;'EV80'!\$Q:\$Q;"<"&\$F\$4+30;'EV80'!\$R:\$R;"7250");""));MIN(MINIFS('EV80'!\$G:\$G;'EV80'!\$P:\$P;"PENDIENTE";'EV80'!\$G:\$G;"<="&\$F\$4);MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4)))

Having obtained this formula, I want to exclude the minimum values obtained from
IF(\$G\$4="YES";MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4;'EV80'!\$Q:\$Q;"<"&\$F\$4+30;'EV80'!\$R:\$R;"R.");"");IF(\$G\$4="YES";MINIFS('EV80'!\$G:\$G;'EV80'!\$G:\$G;"<="&\$F\$4;'EV80'!\$Q:\$Q;">"&\$F\$4;'EV80'!\$Q:\$Q;"<"&\$F\$4+30;'EV80'!\$R:\$R;"7250");"")), instead of including them too

Replies
9
Views
204
Replies
6
Views
122
Replies
6
Views
166
Replies
4
Views
181
Replies
11
Views
259

1,137,060
Messages
5,679,380
Members
419,824
Latest member
Mercy kiara

### 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.

### Which adblocker are you using?

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

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