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 Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

Extract Items Under a Category from the Same Column in Excel

In Excel, you can use a combination of the XLOOKUP and DROP functions to...

How to Create a Searchable Table in Excel Using the FILTER Function

Finding specific records, or rows containing the required information, is straightforward in Excel using...

Time Sequences in Excel by Minute, Hour, or Second Increments

Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

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.