Return value from Vlookup based on column where there is a Max date

deacon10

Board Regular
Joined
Aug 9, 2010
Messages
59
Office Version
  1. 365
Hi there,

I am hoping one of you wonderful people can help me.

The data within Lat! in column B has a few duplicates and I am trying to return a value from columns 34 & 49 where the date in AD is the maximum.

Example data

A1= 123456
Lat!B2= 123456
Lat!B3= 123456
Lat!AD2= 10/05/18
Lat!AD3= 15/06/21

This is my formula so far, I am just not sure how to specify the MAX?

=IFERROR(IF(CG1<>"",VLOOKUP(A1,Lat!B:AO,34,FALSE),VLOOKUP(A1,Rec!:BX,49,FALSE)),"")

Any help always appreciated
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi there,

I am hoping one of you wonderful people can help me.

The data within Lat! in column B has a few duplicates and I am trying to return a value from columns 34 & 49 where the date in AD is the maximum.

Example data

A1= 123456
Lat!B2= 123456
Lat!B3= 123456
Lat!AD2= 10/05/18
Lat!AD3= 15/06/21

This is my formula so far, I am just not sure how to specify the MAX?

=IFERROR(IF(CG1<>"",VLOOKUP(A1,Lat!B:AO,34,FALSE),VLOOKUP(A1,Rec!:BX,49,FALSE)),"")

Any help always appreciated
You can accomplish with a max if array formula. The below will search for the value in A1 in the Lat tab's column B. It will then find the latest date from column AD. Note that the formula has the absolute referencing for columns B and AD. Update to what suits your needs.

Excel Formula:
{=MAX(IF(Lat!$B:$B=A1,Lat!$AD:$AD))}

***Also, be sure to complete the formula with Control + Shift + Enter
 
Upvote 0
How about
Excel Formula:
=INDEX(SORT(FILTER(Lat!AD1:AO10000,Lat!B1:B10000=A1),1,-1),1,12)
 
Upvote 0
Solution
You can accomplish with a max if array formula. The below will search for the value in A1 in the Lat tab's column B. It will then find the latest date from column AD. Note that the formula has the absolute referencing for columns B and AD. Update to what suits your needs.

Excel Formula:
{=MAX(IF(Lat!$B:$B=A1,Lat!$AD:$AD))}

***Also, be sure to complete the formula with Control + Shift + Enter
Thank you breynolds0431, is there away to adapt this into returning a value that isn't the date, from a different column (i.e. column C) to where the date is max in AD?
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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