So in the above example for the first item I want the latest date to be 17th July
With Office 365 use MAXIFS:
=MAXIFS(B:B,A:A,A2)
With Older USE AGGREGATE:
=AGGREGATE(14,6,$B$2:$B$20/($A$2:$A$20=A2),1)
For pre-xl2010 use a psuedo-MAXIFS.
=MAX(INDEX($B$2:$B$20+($A$2:$A$20<>A2)*-1e99, , ))