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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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