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: Returning a Weight and a Date.

Returning a Weight and a Date

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


David asked how he could return a date associated with the maximum value in a particular column. In David's application, he had two columns containing dates and weights associated with those dates. He could figure out how to determine the maximum weight, but not how to pull the date on which that weight occurred.

In this instance, let's assume that the dates are in column A and the weights are in column B, rows 2 through 45. The following is the method of determining the maximum weight in column B:

=MAX(B2:B45)

You are not limited to using the MAX function; you can also use the LARGE function, which returns the largest specified value in a range. If you want the largest value, you use the function in this way:

=LARGE(B1:B45,1)

So far so good. In order to pull the corresponding date from the cell to the left of the date, all you need to do is use one of the lookup functions. The following example uses the INDEX function:

=INDEX(A2:A45,MATCH(MAX(B2:B45),B2:B45,FALSE),1)

The INDEX function pulls the value from row n, column 1 of range A2:A45. The value of n is determined by using MATCH to get the position number of the maximum value of range B2:B45 within that range. For example, if the highest weight is the fourth one on the list (the weight in row 5), the MATCH expression returns 4, therefore the INDEX function returns the date from row 5, column 1 of range A2:A45.

If you wanted, you could simplify the formula even more by just specifying column information within it. In this way, you could have as many entries as desired in columns A and B:

=INDEX(A:A,MATCH(MAX(B:B),B:B,FALSE),1)

You could just as easily use the LARGE function in place of the MAX function in these formulas. If there are two dates that have the same weight associated with them, then only the first matching date is returned. In addition, you will need to format whatever cell contains your formula with a date format.

If your columns are reversed, meaning that the weights are in column A and the dates are in column B, then you would use the VLOOKUP function instead of INDEX, as shown here:

=VLOOKUP(LARGE(A1:A45,1),A1:B45,2,FALSE)

Again, the MAX function could be used in this formula instead of the LARGE function, if desired.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10651) 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: Returning a Weight and a Date.

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

Formatting E-mail using AutoFormat

If you copy the text of an e-mail message to a Word document, you may notice that the formatting of the text leaves a lot ...

Discover More

Comparing Document Versions

Do you need to compare two versions of a document to each other? Word provides a tool that can make this easy, as ...

Discover More

Adding Page Borders to a Printout

Need a full-page border on your Excel printouts? It's not as easy to get one as you might wish. There are a few ways you ...

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)

Non-adjusting References in Formulas

Sometimes making sure that a reference in a formula doesn't get changed is not as simple as putting dollar signs in front ...

Discover More

Returning the Rightmost Value in a Row

Do you need to figure out the rightmost value within a row in which not all cells may contain values? This tip provides a ...

Discover More

Breaking Up Variable-Length Part Numbers

Part numbers can often be long, made up of other component elements. Breaking up part numbers into individual components ...

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?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.