Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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: Finding the Lowest Numbers.

Finding the Lowest Numbers

Written by Allen Wyatt (last updated May 3, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


14

You may have a need at some point to find the lowest numbers in a list of values. This is relatively easy to do if you use the SMALL worksheet function. The function takes two parameters: the range of the values to be evaluated and an indicator of which smallest number you want. For instance, the following will return the second lowest number in the range of A1:A100:

=SMALL(A1:A100,2)

If you wanted to know the two lowest numbers in the range, then use two formulas containing the SMALL function—one with 1 as the second parameter (for the lowest number) and one with 2 as the second parameter (for the second lowest number).

There are situations, of course, where the two smallest numbers in the range could actually be the same number. For instance, if the lowest number is 3 and there is a second 3 in the list, then both the lowest numbers will be the same. If you want the two lowest unique numbers then you will need to use a macro to determine them.

Function SMALLn(rng As Range, n)
    Application.Volatile
    SMALLn = False
    If n < 1 Then Exit Function
    Dim i As Long, j As Long, k As Long, min, arr, arr2
    arr = Application.Transpose(rng)
    ReDim arr2(n - 1)
    min = Application.WorksheetFunction.Min(arr)
    j = UBound(arr)
    k = 0
    arr2(k) = min
    For i = 1 To j
        If Application.Small(arr, i) <> arr2(k) Then
            k = k + 1
            arr2(k) = Application.Small(arr, i)
            If k = n - 1 Then
                SMALLn = arr2(k)
                Exit For
            End If
        End If
    Next i
End Function

This user-defined function is used in the following manner:

=SMALLn(A1:A100,2)

When called like this, the function returns the second lowest unique value in the specified range.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10944) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Finding the Lowest Numbers.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Restoring the Analysis ToolPak

Add-ins for Excel, such as the Analysis ToolPak, are stored in files on your hard drive that can be deleted. If you ...

Discover More

Quickly Displaying the Style Dialog Box

If you display the style area, you can quickly display the Style dialog box.

Discover More

Discovering Printer Drift

How accurate is your printer when it comes to placing information on the printed page? The simple technique described in ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Returning Blanks with VLOOKUP

Normally the VLOOKUP function returns a value, and if it can't return a value it returns a zero. Here's how you can use ...

Discover More

Checking for Text

Need to figure out if a particular cell contains text? You can use the ISTEXT function to easily return this bit of trivia.

Discover More

Returning the Left-most Characters

When working with text in a formula, you may need to extract the left-most characters from a string of text or from a ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 7?

2023-05-03 10:15:37

Don Small

No need for a macro. There's a much simpler way to determine the smallest unique number: =SMALL(UNIQUE(A1:A12),2)


2023-05-03 05:56:17

Kiwerry

Thank you, Micky, for your UDF.
I always have Option Explicit in my modules, so had to add some Dimension statements but then it worked fine.


2016-09-07 08:48:51

Ron Owens

I need a formula to select the low four numbers from a column and then add those four numbers.

These are golf match scores. I need to select the low four for a team then add those four scores for a team total.


2014-12-14 15:38:24

Michael (Micky) Avidan

@Locke,
1) No problem (as for your addition to my formula).
2) in the UDF - you may omit the: nn = Rng.Count
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-12-14 14:12:39

Lock Garmin

@Micky

No problem. In the cases where you can make the assumption that your range is all numbers (which would be most cases) I would use your solution in a heart beat. I just wanted to add to your solution so that it behaved a little more like the SMALL/LARGE functions. You're formula solution is perfectly valid. :)

Nice UDF!


2014-12-14 06:59:04

Michael (Micky) Avidan

@Locke,
My suggested formula was written as per the above tip - therefor I didn't considered textual values within the range.
Here is my suggestion for a "sufisticated" UDF.
a) Rng is for the Range of cells.
b) The second argument is the position k.
c) The last argument should be "S" for Small or "L" for Large.
----------------------------------------------
Function Large_SmallUnique(Rng As Range, k, LS)
Dim NewList As New Collection
nn = Rng.Count
On Error Resume Next
For Each CL In Rng
NewList.Add CL, CStr(CL)
Next
ReDim arr(NewList.Count)
For P = 1 To NewList.Count
arr(P) = NewList(P)
Next
If UCase(LS) = "L" Then
Large_SmallUnique = Application.Large(arr, k)
Else
Large_SmallUnique = Application.Small(arr, k)
End If
End Function
-------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-12-13 19:18:03

Michael (Micky) Avidan

@Roy,
Allens coding is a USER DEFINED FUNCTION - and as such it MUST be typed into a Module and not in both places you have mentioned.
My previous disclosure remains the same.
Try to study the following link:
http://dmcritchie.mvps.org/excel/getstarted.htm
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-12-13 15:46:46

Locke Garmin

@Roy

You'll need to create a module. UDFs don't work in Sheet or Workbook objects.


2014-12-13 15:41:58

Locke Garmin

@Micky

In playing with your formula I discovered for the first time that SMALL/LARGE ignore TRUE/FALSE values. Always a new discovery! Not sure how I never realized it before.

I noticed that the formula breaks if your range contains text or boolean values. This can be overcome with the following modification:

=SMALL(IF(FREQUENCY(MATCH($A$1:$A$10,$A$1:$A$10,0),MATCH($A$1:$A$10,$A$1:$A$10,0)),A$1:A$11),ROW(A1))


2014-12-13 10:00:54

Ralph Shumaker

In a large worksheet, I decide to find the smallest number, so I entered =, then END, then Home. to find all active cells. I then edited the formula to =small(A1:K7580) and received an error. then I added ,2) to the formula and got a 0. So I increased the decimals and still received a zero. So I thought the lowest number must be zero or the formula will not work if some cells contain text, so I edited the formula to =large(A1:a100,1) and received a large number. I then edited my small formula and received a -121 and the other formulas re-computed. Now I'm wondering why my initial entry did not work.


2014-12-13 06:52:59

Roy

@Micky

My ignorance is showing, I copied Allens coding into both sheet1 and thisworkbook but the function was not available. What did I do wrong?

Roy


2014-12-13 06:13:48

Michael (Micky) Avidan

@Roy,
Correct assumption, especially as far as my formula is concerned.
***Disclosure:
I didn't examine the proposed UDF.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-12-13 06:07:52

Michael (Micky) Avidan

No need for a UDF.
Assume the range of numbers are in A1:A10:
3
-3
6
7
-2
8
5
5
-2
-3
Now, type the following formula into cell D1 and copy down as far as needed.
=SMALL(IF(FREQUENCY(A$1:A$10,A$1:A$10),A$1:A$11),ROW(A1))
Double click to see a pictured demonstration:
http://postimg.org/image/phqgmhff3/
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL



2014-12-13 06:00:51

Roy

One assumes you could also use the principle for obtaining the LARGEst unique numbers.


This Site

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.

Newest Tips
Subscribe

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

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.