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


[TABLE="width: 195"]
<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>[TR]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 68, bgcolor: transparent"]NSW[/TD]
[TD="width: 64, bgcolor: transparent"]QLD[/TD]
[TD="width: 64, bgcolor: transparent"]VIC[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]50[/TD]

[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]STATE[/TD]
[TD="bgcolor: transparent"]DATE[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]NSW[/TD]
[TD="bgcolor: transparent, align: right"]1/01/2019[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]QLD[/TD]
[TD="bgcolor: transparent, align: right"]3/01/2019[/TD]
[TD="bgcolor: transparent, align: right"]20[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]VIC[/TD]
[TD="bgcolor: transparent, align: right"]4/01/2019[/TD]
[TD="bgcolor: transparent, align: right"]50[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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