Google-sheets – Force cell to zero if result is below zero or N/A

google sheetsgoogle-apps

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

The number I'm getting from the query is almost always negative (a list of transactions) so if it's more than zero, I want it to default to zero.

This is what I currently have and it's returning the zero as I'd like but not if the result of the query is #N/A

=MIN( SUM(FILTER( TRANSACTIONS! C4:C51; TRANSACTIONS! D4:D51="Other")) , 0)

Best Answer

Answering my own question. IFERROR is what I needed to use.

=IFERROR(MIN(SUM(FILTER(TRANSACTIONS! C4:C51; TRANSACTIONS! D4:D51="Other"))) ,0)