**Please Note: **
This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), *this tip may not work for you*. For a version of this tip written specifically for earlier versions of Excel, click here: Returning the Smallest Non-Zero Value.

Mark is hoping to find the smallest non-zero value in a set of values. For example, if he has the values 0,0,3,0,6,8, he would want the value 3 (the smallest non-zero value) returned by a formula. Mark knows he can use the SMALL function with the second argument calculated by using a COUNTIF to count the number of zeroes in the range. However, he wants to use this inside of an array formula, and Excel can't handle COUNTIFs inside of array formulas.

Since Mark is only interested in array formulas (entered by pressing **Ctrl+Shift+Enter**), then there are a couple that could be used. The following array formula is worth looking at first:

=MIN(IF(A1:A5=0,MAX(A1:A5),A1:A5))

Assuming the values to be examined are in A1:A5, this formula puts together an array of non-zero values from that range. If the value in one of the cells is 0, then the MAX function kicks in, returning the largest value from the range. (This essentially kicks the value at that cell—originally 0—out of consideration as the smallest value.) If the value in one of the cells is not 0, then the actual value is returned. The MIN function then returns the lowest value from the array.

You can make the formula even shorter by turning it around in this manner:

=MIN(IF(A1:A5<>0,A1:A5))

Note that in this version, the value in each cell of the range is checked to see if it isn't 0. If it isn't, then the value is returned. If it is 0, then nothing is returned. Again, the MIN function is used to return the lowest value from the array.

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (9330) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: **Returning the Smallest Non-Zero Value**.

**Comprehensive VBA Guide** Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out *Mastering VBA for Office 2010* today!

There are times when it can be beneficial to combine both numbers and text in the same cell. This can be easily done ...

Discover MoreCircular references occur when a formula includes a reference to the cell in which the formula appears. Here's how you ...

Discover MoreIf you have two columns containing dates and weights from those dates, you may want to pick a date associated with a ...

Discover More**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

2018-05-22 12:56:15

Allan

Why not just sort from largest to smallest and delete the zeros.

2018-05-22 03:30:20

gerdami

https://support.office.com/en-us/article/minifs-function-6ca1ddaa-079b-4e74-80cc-72eef32e6599

2016-11-30 15:04:36

TerryG

Ditto on the Ctrl+Shift+Enter AFTER entering the formula, or it won't work!!

2016-08-25 00:19:05

Ayush

2016-05-20 06:17:43

Michael (Micky) Avidan

@Rod,

The following example is more appropriate.

(see Figure 1 below)

**Figure 1.**

2016-05-20 06:15:13

Michael (Micky) Avidan

@Rod,

Both work EXACTLY(!) as expected.

(see Figure 1 below)

**Figure 1.**

2016-05-19 06:50:45

Rod bennett

=MIN(IF(A1:A5=0,MAX(A1:A5),A1:A5)) returns the maximum value

=MIN(IF(A1:A5<>0,A1:A5)) returns zero

2016-02-14 05:24:01

Mags

Thanks Willy, entering the formula with Ctrl+Shift+Enter got it right.

2015-11-26 12:09:31

Willy Vanhaelen

Did you enter the formula with Ctrl+Shift+Enter?

2015-11-25 19:38:31

tiki

I have four vendor columns some with prices some with $00.00, but none of the the formulas that I have tracked down can go to the next low number if it has a $00.00 value in the cell. I have tried about twenty or so combinations.

Got a version of Excel that uses the
ribbon interface (Excel 2007 or later)?
**This site is for you!** If you
use an earlier version of Excel, visit
our *ExcelTips* site focusing on the menu interface.

**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

Copyright © 2020 Sharon Parq Associates, Inc.

## Comments