vlookup base on a maximum/latest condition

cantab429

New Member
Joined
Mar 24, 2019
Messages
8
Hi guys,

I am having trouble with a formula to determine the latest value on a vlookup. The following is an example:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Apples[/TD]
[TD]ordered[/TD]
[TD]2/4/2019[/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]backfilled[/TD]
[TD]2/4/2019[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]arrived[/TD]
[TD]3/4/2019[/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]arrived[/TD]
[TD]3/4/2019[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]backstock[/TD]
[TD]4/4/2019[/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]missing[/TD]
[TD]4/4/2019[/TD]
[/TR]
</tbody>[/TABLE]

I want to be able to write a formula thats based on the keyword "Apple" but look for the latest entry, so in this case, it will return "backstock".

I cant get this to work with even index match... any help would be greatly appreciated!

Thanks.!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try out the below. You can copy/paste the below table into excel so you see how it operates.

F2 (Entered with Ctrl+Shift+Enter):
Code:
=INDEX($B$2:$B$7,MATCH(E2&MAX($C$2:$C$7*($A$2:$A$7=E2)),$A$2:$A$7&$C$2:$C$7,0))

[TABLE="width: 366"]
<colgroup><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD]Type[/TD]
[TD]Result[/TD]
[TD]Dates[/TD]
[TD][/TD]
[TD]Criteria[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]ordered[/TD]
[TD="align: right"]2/4/2019[/TD]
[TD][/TD]
[TD]Apples[/TD]
[TD]backstock[/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]backfilled[/TD]
[TD="align: right"]2/4/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]arrived[/TD]
[TD="align: right"]3/4/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]arrived[/TD]
[TD="align: right"]3/4/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]backstock[/TD]
[TD="align: right"]4/4/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]missing[/TD]
[TD="align: right"]4/4/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
That formula works great! It shows me that I really need to understand array formulas better. Thank you, CyrusTheVirus!

Is there a way to stylize it so that it will ignore blank entries. Let's say the Results column has blank cells that may be associated with later dates in the Dates column. Is there a way to alter that to find only the most recent entry instead of returning a value of 0?
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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