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 Dates for Minimums and Maximums.

Finding the Dates for Minimums and Maximums

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


4

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 (9662) 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 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

Counting Changed Words

Track Changes is a handy tool for those who need to see how a document changes over time. If you have a long document ...

Discover More

Creating Hyperlinks from E-mail Addresses

Got a document that has a whole raft of e-mail address in it? You can easily convert all of them to clickable hyperlinks ...

Discover More

Converting Time Notation to Decimal Notation

Want to convert an elapsed time, such as 8:37, to a decimal time, such as 8.62? If you know how Excel stores times ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Returning Nothing If Two Values are Empty

Excel includes a large number of functions that can be used in evaluating the data in a worksheet. In this tip you learn ...

Discover More

Calculating Months of Tenure

Need to know the number of months between two dates? It's easy to figure out if you use the DATEDIF function.

Discover More

Finding the Previous Work Day

Simple math will tell you what the previous day is (just subtract 1 from today's date). What if you want to know the date ...

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 four minus 0?

2021-04-19 02:57:01

Peter Kanters

XLOOKUP is only available in Office 365 which includes other handy new functions like UNIQUE and XMATCH


2021-04-17 17:02:44

John Mann

I can't find XLOOKUP() on my version of Xcel (2010). Can I add it somehow? or is it limited Excel365?

I WILL NOT use Office 365 to for 2 reasons: (1) I have a metered internet connection so want all my software and data storage local. & (2) It reminds me of the now antique conecpt from the sixties and seventies known at time-sharing


2021-04-06 03:15:43

Peter Kanters

The new XLOOKUP() function also does not bother anymore about the order of the search column. It can search in column B and return data from column A or another non-adjacent column. No need for CHOOSE() anymore.


2021-04-03 13:06:09

Tom Kadlec

You can use VLOOKUP using the following formula:

=VLOOKUP(MIN(B:B), CHOOSE({1,2},B:B,A:A),2,FALSE)
=VLOOKUP(MAX(B:B), CHOOSE({1,2},B:B,A:A),2,FALSE)

Where CHOOSE({1,2},B:B,A:A) produces an array that effectively reverses the order of the columns A and B.
VLOOKUP searches for a match in the first column of the CHOOSE array (B:B - expenditure) and returns the value from the second column of the CHOOSE array (A:A - date).

This formula can be used to search non-adjacent columns or columns from different sheets.


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.