Returning the cell with the highest value from adjacent column

stillanewbie

New Member
Joined
Nov 8, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I need to return the most recent date that is associated to a columns inputs. So in the example: for every Flavor input (of which there can be multiple of the same) there is a corresponding date. I would like to return the most recent date associated with each flavor.

Sorry if I haven't explained this too well but I think the below table will give you a good idea of what I am trying to achieve. Thanks!

DATEFlavorExpected Output
Dec-12ChocDec-18
Dec-14VanillaDec-20
Dec-18ChocDec-18
Dec-17StrawberryDec-17
Dec-20VanillaDec-20
Dec-09StrawberryDec-17
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
with power query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"DATE", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Flavor"}, {{"Max Date", each List.Max([DATE]), type nullable date}, {"Data", each _, type table [DATE=nullable date, Flavor=text]}}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"DATE"}, {"DATE"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Data",{"Flavor", "DATE", "Max Date"})
in
    #"Reordered Columns"

Book1
DEF
1FlavorDATEMax Date
2Choc12/12/202112/18/2021
3Choc12/18/202112/18/2021
4Vanilla12/14/202112/20/2021
5Vanilla12/20/202112/20/2021
6Strawberry12/17/202112/17/2021
7Strawberry12/9/202112/17/2021
Sheet1
 
Upvote 0
Hi, welcome to the forum!

Here is another option you could try.

Book3
ABC
1DATEFlavorExpected Output
201/12/2012Choc01/12/2018
301/12/2014Vanilla01/12/2020
401/12/2018Choc01/12/2018
501/12/2017Strawberry01/12/2017
601/12/2020Vanilla01/12/2020
701/12/2009Strawberry01/12/2017
Sheet1
Cell Formulas
RangeFormula
C2:C7C2=MAXIFS(A:A,B:B,B2)
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,850
Members
449,194
Latest member
HellScout

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