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 Address of the Lowest Value in a Range.

Finding the Address of the Lowest Value in a Range

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


2

When writing a macro, you can find the lowest value in a range of cells by using the WorksheetFunction method to apply the MIN worksheet function. You may need, however, to not only find the lowest value in the range, but also the address of the first cell that contains that value.

One simple way is to simply step through the range you want to examine and derive both the lowest value and the address of the cell being examined, as in the following:

Function FindLowestAddr(pRng As Range) As String
    Dim MinVal As Double
    Dim MinAddr As String
    Dim c As Range

    MinVal = pRng.Cells(1).Value
    MinAddr = pRng.Cells(1).Address
    For Each c in pRng
        If c.Value < MinVal Then
            MinVal = c.Value
            MinAddr = c.Address
        End If
    Next c
    FindLowestAddr = MinAddr
End Function

Note that this approach doesn't rely upon the MIN worksheet function at all. There is a drawback to it, however—it doesn't differentiate between cells that contain numeric values and those that don't. In other words, if the range passed to the function contains a blank cell, that cell is considered to contain a zero value, which may very well be the lowest value in the range.

One way around this is to rely upon worksheet functions from within the macro. The following macro uses both the MIN and MATCH worksheet functions to determine the location of the minimum value and then the index (offset) of that cell within the range.

Function GetAddr(rng As Range) As String
    Dim dMin As Double
    Dim lIndex As Long
    Dim sAddress As String

    With Application.WorksheetFunction
        dMin = .Min(rng)
        lIndex = .Match(dMin, rng, 0)
    End With
    GetAddr = rng.Cells(lIndex).Address
End Function

It should be noted that if you are using the macro only to discover the address because you figured there was no way to derive the desired information without the macro, then you can do away with the macro entirely by using a worksheet formula. For instance, if you want to determine the address of the lowest-valued cell in the named range MyRange, you could use the following:

=ADDRESS(ROW(MyRange)+MATCH(MIN(MyRange),MyRange,0)-1,COLUMN(MyRange))

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 (12744) 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 Address of the Lowest Value in a Range.

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

Margin Notes in Word

Some types of documents rely upon margin notes to the left or right of your main text. Getting these to appear in Word ...

Discover More

Understanding Monospace Fonts

Information in a worksheet needs to be displayed using fonts. If you understand the two different types of fonts ...

Discover More

Rounding Up to a Value Ending in 9

Need to round values up to the next value that ends in 9? There are a number of ways you can accomplish the task through ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Combining Numbers and Text in a Cell

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

Discover More

Formatting Canadian Postal Codes

Postal codes in Canada consist of six characters, separated into two groups. This tip explains the format and then shows ...

Discover More

Indirectly Referencing a Cell on a Different Worksheet

Excel includes the powerful INDIRECT function which can be used to assemble references to other cells in your workbook. ...

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 1 + 1?

2022-05-17 04:27:29

Mike H

To find the address of the lowest value in a one column range why not use

=ADDRESS(SMALL(MyRange,1),1)


2018-09-18 09:14:46

David Robinson

That last formula will only work if your range is in a single column.

I can suggest another method that doesn't involve using a macro... If you create a "helper" row and column. It will only work if the smallest value is unique however, because it doesn't do well with ties.

Below (or above) your data range, enter a formula that finds the MIN value in each column of the range, and fill this formula across. Call this HelperRow. Do the same to the right (or left) of your data range, finding the MIN in each row. Call this HelpCol. Then you can return the address by seeking the MIN value in the whole range in each helper column individually, namely

=ADDRESS(ROW(MyRange) + MATCH(MIN(MyRange), HelperCol,0)-1, COLUMN(MyRange) + MATCH(MIN(MyRange),HelperRow,0)-1)

It can't cope with ties because it finds the column with min value and row with min value and assumes the intersection of these is the lowest value, which may not be the case with multiple smallest values.


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.