look up maximum date and state

sampal

New Member
Joined
Sep 29, 2011
Messages
5
Hi I need a formula to look up maximum date and corresponding state

In below case it should look at state , eg VIC and also maximum date 04/01/2019, giving answer 50


NSWQLDVIC

50
STATEDATE
NSW1/01/201910
QLD3/01/201920
VIC4/01/201950
<colgroup><col width="64" style="width: 48pt;"> <col width="68" style="width: 51pt; mso-width-source: userset; mso-width-alt: 2486;"> <col width="64" style="width: 48pt;" span="2"> <tbody> </tbody>
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Maybe something like this.
This is an array formula and must be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABC
1NSWQLDVIC
2102050
3
4STATEDATE
5NSW10/12/200825
6QLD3/1/201920
7VIC4/1/201950
8VIC3/12/201830
9NSW1/1/201910
Sheet
 
Upvote 0
also could you please break down this formula, I am trying hard to understand how this works ?
 
Upvote 0
The | symbol is above the ENTER key that also has the \ symbol. It's only use is to put a character (actual almost any character would do) between the state and date. In this case it's probably not needed. The example below shows why you may need it in some cases.
Column C below gives two unique alphanumeric data. Where column D returns the same alphanumeric data.
Excel Workbook
C
2AB1|456
Sheet


Formula breakdown.
This part returns the max date if the state equals cell A1 in this example.
Code:
MAX(IF($A$5:$A$9=A$1,$B$5:$B$9))
returns
1/1/2019

This will return state and max date.
Code:
A$1&"|"&MAX(IF($A$5:$A$9=A$1,$B$5:$B$9))
returns
NSW|1/1/2019

MATCH will return the row number where it finds the above.
Code:
MATCH(A$1&"|"&MAX(IF($A$5:$A$9=A$1,$B$5:$B$9)),$A$5:$A$9&"|"&$B$5:$B$9,0)
returns row 5 in this case.

MATCH just tells the INDEX what row to bring back the data from in the table, so in this case row 5 of column C in the data equals 10.
 
Upvote 0
The example in the post above for using the | symbol should have been.
Excel Workbook
ABCD
1DifferentSame
2AB1456AB1|456AB1456
3AB1456AB|1456AB1456
Sheet
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top