Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Finding the Dates for Minimums and Maximums.

Finding the Dates for Minimums and Maximums

by Allen Wyatt
(last updated March 28, 2015)

Michael has some data in two columns of a worksheet. Column A is a series of dates and column B contains expenditures for each of those dates. He needs a way to determine the date on which the minimum expenditure occurred and a way to find the date on which the maximum expenditure occurred.

At first glance you might be tempted to think you could use VLOOKUP to figure out the desired date. Unfortunately, that won't work because VLOOKUP keys off of whatever data is in the first column of your data table. Since you want to key off of the amount (looking for the minimum and maximum), you would need to switch the position of the columns, so that column A contained the amount and column B contained the dates. If you do that, you could then use the following formulas to find the dates for the minimum and maximum expenditures, respectively:

```=VLOOKUP(MIN(A:A),A:B,2,0)
=VLOOKUP(MAX(A:A),A:B,2,0)
```

If you cannot change the data columns, then you'll need to forego VLOOKUP and use a different approach, instead. The following two formulas will work with the data as originally specified by Michael:

```=INDEX(A:A,MATCH(MIN(B:B),B:B,0))
=INDEX(A:A,MATCH(MAX(B:B),B:B,0))
```

It is important to note that if there are duplicates of the maximum and/or minimum expenditures, these formulas will only find the dates of the first occurrences. If this is not expected to happen often, a formula such as this could be used to alert the user to the existence of duplicates:

```=IF(COUNTIF(B:B, MAX(B:B))>1, "Multiple Maximums ",
INDEX(A:A, MATCH(MAX(B:B), B:B, 0)))
```

To make this formula work for minimums, just replace the two instances of MAX with MIN and change the word "Maximums" to "Minimums."

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9661) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Finding the Dates for Minimums and Maximums.

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

Determining If the End of a Text File Has Been Reached

When writing a macro that processes a text file, you may need to know when the end of the file has been reached. This is ...

Discover More

Adjusting Row Height for a Number of Worksheets

Adjusting the height of a row or range of rows is relatively easy in Excel. How do you adjust the height of those same ...

Discover More

Automatically Adding 20% to an Entry

When you are developing a worksheet for others to use, you may want to have entries in a particular cell (or cells) be ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

Incrementing Months in Dates

Excel can easily store dates. If you want to increment a date by one month, there are a number of ways you can accomplish ...

Discover More

Calculating a Date Five Days before the First Business Day

Excel allows you to perform all sorts of calculations using dates. A good example of this is using a formula to figure ...

Discover More

Deciphering a Coded Date

It is no secret that Excel allows you to work with dates in your worksheets. Getting your information into a format that ...

Discover More
Subscribe

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

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}] 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 nine more than 0?

2015-03-30 11:57:54

Scott Renz

You can look up to the left this way:
=VLOOKUP(MIN(B:B),CHOOSE({2,1},A:A,B:B),2,0)
=VLOOKUP(MAX(B:B),CHOOSE({2,1},A:A,B:B),2,0)

This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.