Find the Min from two SUMIFs - Ignore Zero's

CodyMonster

Board Regular
Joined
Sep 28, 2009
Messages
159
I'm trying to figure out how to get the minimum value from two sumifs while ignoring zeros and negative values.
I've been trying to work this out with nested IFs.. and I'm not getting very far.
For example:
Sumif #1: 5
Sumif #2: 0
Returns 5

However
Sumif #1: 5
Sumif #2: 2
Returns 2

Additionally,
Sumif #1: 5
Sumif #2: -2
Returns 5

Hope this makes sense?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
This will work:
Code:
=MIN(IF(D3<=0,1E+99,D3),IF(D4<=0,1E+99,D4))

In English, it is asking for the minimum of D3 or D4, as long as that number is greater than 0. If the number is less than zero, it converts the number to infinity so it won't ever be the minimum. (1E+99 is a substitution for infinity).

**I just edited this post to make the formula "<= 0" instead of "=0". I misread the original parameters** Code above should be correct.

Screenshot 2022-09-15 214932.png
 
Last edited:
Upvote 0
Solution
This will work:
Code:
=MIN(IF(D3<=0,1E+99,D3),IF(D4<=0,1E+99,D4))

In English, it is asking for the minimum of D3 or D4, as long as that number is greater than 0. If the number is less than zero, it converts the number to infinity so it won't ever be the minimum. (1E+99 is a substitution for infinity).

**I just edited this post to make the formula "<= 0" instead of "=0". I misread the original parameters** Code above should be correct.

View attachment 74080

Got it to work..
Thanks... I would have never thought of the 1E+99 as infinity.
It's funny how all my questions, at the end of the day, aren't that complicated.
But I'm good at making it complicated.

:)
 
Upvote 0

Forum statistics

Threads
1,215,584
Messages
6,125,670
Members
449,248
Latest member
wayneho98

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