How to Exclude Zeros from MIN Function Results in Google Sheets

Published on

The MIN function helps you find the smallest value in a range. But to exclude zeros when returning the minimum value, you need to use a function that accepts criteria.

You can use MINIFS or FILTER with MIN for this purpose. If the values from which you want to return the minimum excluding zeros are spread across more than one column (a 2D array), you may also require the TOCOL function.

MIN Excluding Zeros in a Column or Row in Google Sheets

I will give two examples using vertical data. You can apply the same to a horizontal list as well.

MINIFS Solution

The following formula will return the minimum value excluding zeros in column A in Google Sheets:

=MINIFS(A1:A, A1:A, "<>0")
Using MINIFS to exclude zeros

This follows the syntax:

MINIFS(range, criteria_range1, criterion1, [criteria_range2, …], [criterion2, …])

Where:

  • range: A1:A
  • criteria_range1: A1:A
  • criterion1: “<>0”

The MINIFS function returns the minimum value by filtering the criteria range based on the provided condition, which is “<>0”.

FILTER and MIN Solution

Here, we use the FILTER function to filter the range and then apply MIN to that filtered range:

=MIN(FILTER(A1:A, A1:A<>0))

It follows the FILTER syntax:

FILTER(range, condition1, [condition2, …])

Where:

  • range: A1:A
  • condition: A1:A<>0

From the above two formulas, I recommend using MINIFS because it can return the min value excluding zeros in a 2D array as well.

MIN Excluding Zeros in a 2D Array in Google Sheets

Assume you want to extract the minimum value excluding zeros in A1:C10, a 2D array.

The MINIFS formula will work without any issues:

=MINIFS(A1:C10, A1:C10, "<>0")
MIN excluding zeros in 2D array in Google Sheets

However, the FILTER and MIN combination won’t work directly because the ‘condition’ part in the FILTER function should be one-dimensional.

To handle this, use the TOCOL function to convert the 2D array to a one-dimensional array. Here is the combination:

=MIN(FILTER(TOCOL(A1:C10), TOCOL(A1:C10)<>0))

Why Does the MINIFS Formula Return 0?

When the range to find the min excluding zero is blank, MINIFS will return 0, and the FILTER+MIN combination will return a #N/A error.

How do I return an empty cell instead?

If you use the FILTER and MIN combination, simply wrap it with the IFNA function:

Example:

=IFNA(MIN(FILTER(A1:A, A1:A<>0)))

But if you use MINIFS, it’s not as straightforward. You should use an IF logical test:

=LET(test, MINIFS(A1:A, A1:A, "<>0"), IF(test<>0,test,))

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

More like this

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

4 COMMENTS

  1. One other thing I left out. Another thing I need to do is, once the array finds the lowest value excluding zero, I need it to return the name of the lowest value. Same for the second, third, and lowest overall.

    Thank you,
    Nuria

    • Hi, Nuria Anderson,

      I think I can help you here.

      We can use Query or ArrayConstrain+Sort. It depends on your data.

      Can you prepare and share a sample sheet? So that I can write the formula and share the steps on the sheet.

      You can leave the URL via “Reply” to this comment (I won’t publish it).

  2. I found your answers to be very helpful when other places were of no help whatsoever. I need an additional step, however.

    My data is in every other column (think the description in one and pricing on the other, so the numbers are in every other column). I need to find the first lowest excluding zero, which I have done with the Query.

    Thank you for that, by the way!

    Now in the same array, I need to find the second-lowest, third lowest, and overall lowest number.

    How do I do that?

    I appreciate your insight on this.

    Thanks again!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.