Google-sheets – How to zero out cell if filtered sum is less than 0

google sheets

I currently have the exact function set up here: Summing a column, filtered based on another column in Google Spreadsheet

I would like to know how to make the value 0 if the real sum is less than 0. Any help?

Additionally, if the sum from all the cells I'm adding returns no value at all (if no cells meet the criteria), I'd like to make the result "0".

Best Answer

For your first question, I'd expect the MAX() function to give you what you need.

=MAX(SUM(A1:A5),0)

MAX() returns the maximum value in a list of arguments. In this case, if the SUM() returns a value less than zero (i.e., negative) it'll return the zero instead.