Extract latest date from mixed range.

uceaamh

New Member
Joined
Feb 23, 2017
Messages
27
Hello,

I am trying to extract the latest date from a range of dates, with a unique identifier as the criteria. My data looks like:

Sheet1
AB

<tbody>
</tbody>

IdentifierDates
121/2/1900
103/1/1901
121/5/1899
132/3/1900
197/4/1901
104/2/1901
121/5/1900
143/2/1901
106/5/1901

<tbody>
</tbody>

And I would like my output (in a different sheet) to look like:

Sheet2
AB

<tbody>
</tbody>


121/5/1901
106/5/1901
132/3/1900

<tbody>
</tbody>

So far I have tried (as the input to Sheet2!B) :

Code:
=if(sheet2!A1=Sheet1!A:A,max(sheet1!b:b),"")

Code:
=SUMPRODUCT((sheet2!A1=Sheet1!A:A)*1,(Sheet1!B)*1)

to no avail. The closest I have got is:

Code:
=SUMIFS(Sheet1!B,Sheet1!A:A,Sheet2!A1)
- but that sums all the date ranges, so my answer will be 2/3/2676.

Any help would be appreciated!

Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try a pivot table

row field - identifier
values - dates (then change the value field setting for "dates" to "max of dates"


Row LabelsMax of Dates
106/05/1901
121/05/1900
132/03/1900
143/02/1901
197/04/1901

<colgroup><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
If you want a formula solution...


Book1
AB
1IdentifierDates
2121/2/1900
3103/1/1901
4121/5/1899
5132/3/1900
6197/4/1901
7104/2/1901
8121/5/1900
9143/2/1901
10106/5/1901
Sheet1



Book1
AB
15
2idmax date
3106/5/1901
4121/5/1900
5132/3/1900
6143/2/1901
7197/4/1901
8
Sheet2


In A1 control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(Sheet1!A2:A10,Sheet1!A2:A10),1))

In A3 control+shift+enter, not just enter, and copy down:

=IF(ROWS($1:1)>$A$1,"",MIN(IF(ISNA(MATCH(Sheet1!$A$2:$A$10,$A$2:A2,0)),Sheet1!$A$2:$A$10)))

In B3 control+shift+enter, not just enter, and copy down:

=MAX(IF(Sheet1!$A$2:$A$10=$A3,Sheet1!$B$2:$B$10))

If you have MAXIFS, in B3 just enter and copy down:

=MAXIFS(Sheet1!$B$2:$B$10,Sheet1!$A$2:$A$10,$A3)
 
Upvote 0
Thanks for the replies @liveinhope and @Aladin Akyurek. Unfortunately I am having problems with both approaches.

liveinhope:

I was thinking about a pivot, but I'm not sure if I can. The data from sheet 1 and sheet 2 are both from separate Excel spreadsheets. I'm pulling them in via a Query, so they update automatically. Since they come in as separate queries, I don't know how to make a pivot relying on both of them. Is there a way to build a pivot using the IDs from Sheet 2 and Dates from Sheet1?


Aladin Akyurek:

I tried following through those approaches, but in A1, =SUM(IF(FREQUENCY(Sheet1!A2:A10,Sheet1!A2:A10),1)) , the return is 0. That means the formula in A3 returns "", and nothing follows on.

In sheet 2 I already have a list of the unique IDs I am after, so I tried the MAX/MAXIFS formulas. The MAX formula returns 0, and the MAXIFS returns #VALUE . I tried it using both the cell reference (a2 etc.) and the named ranges, with the same effect either way.



Thanks again for the responses!
 
Upvote 0
Control+shift+enter means press down the control and the shift keys at the same time while you hit the enter key. When done successfully, Excel itself puts a pair of { and } around the formula in recognition.
 
Upvote 0
Thanks Aladin. I did input using ctrl+shift+enter, and saw the { } brackets around the formula. Still, I was getting 0 and #VALUE with the ctrl+shift+enter.
 
Upvote 0
Thanks for the suggestions. I finally made it work by merging the separate data queries and running a pivot table off of that data.

Again, I appreciate your time and effort!
 
Upvote 0

Forum statistics

Threads
1,214,547
Messages
6,120,139
Members
448,948
Latest member
spamiki

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