finding a text in multiple fields and then get the max of a date field field based on that text for Google Sheets.

sdas34

New Member
Joined
Jan 8, 2021
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a dataset where it has a Date field and there are 4 or more than 4 'Resource Name' columns. The name could be repetitive in each column but it will not be repetitive in each row. Now, I have a list of unique resource name and I need to find out the max Date for a particular resource. I have attached a sample data and the outcome I am looking for. Any help will be appreciated. Thanks in advance.

Dataset:
DateResource 1Resource 2Resource 3Resource 4
1 Jan 2022John
25 Mar 2022KaneMaria
15 Jun 2022HarryJohn
18 Jul 2022Emily
23 Oct 2022ArinKane
29 Dec 2022MariaHarry

Output:
ResourcesMax Date
John15 Jun 2022
Kane23 Oct 2022
Harry29 Dec 2022
Emily18 Jul 2022
Arin23 Oct 2022
Maria29 Dec 2022
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
With Power Query, unpivot your data and then group by the name for the maximum date

Book5
ABCDE
1DateResource 1Resource 2Resource 3Resource 4
21-Jan-22John
325-Mar-22KaneMaria
415-Jun-22HarryJohn
518-Jul-22Emily
623-Oct-22ArinKane
729-Dec-22MariaHarry
8
9ValueMax Date
10John6/15/2022
11Kane10/23/2022
12Maria12/29/2022
13Harry12/29/2022
14Emily7/18/2022
15Arin10/23/2022
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Value"}, {{"Max Date", each List.Max([Date]), type nullable date}})
in
    #"Grouped Rows"
 
Upvote 0
With Power Query, unpivot your data and then group by the name for the maximum date

Book5
ABCDE
1DateResource 1Resource 2Resource 3Resource 4
21-Jan-22John
325-Mar-22KaneMaria
415-Jun-22HarryJohn
518-Jul-22Emily
623-Oct-22ArinKane
729-Dec-22MariaHarry
8
9ValueMax Date
10John6/15/2022
11Kane10/23/2022
12Maria12/29/2022
13Harry12/29/2022
14Emily7/18/2022
15Arin10/23/2022
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Value"}, {{"Max Date", each List.Max([Date]), type nullable date}})
in
    #"Grouped Rows"
Hi, thanks for your reply. Actually I need to do this in Google sheet. And I guess Google sheet doesn't support power pivot. Hence, I need to use a formula
 
Upvote 0
Thanks for the suggestions. It is solved now. I have used Arrayformula with Max and if condition to solve it. E.g: Arrayformula(Max(if(sheet1!a:d=b2, sheet1!c:c))). Here sheet1!a:d is range of lookup list, b2 is lookup value, sheet1!c:c is range of date. It's returning the result.
 
Upvote 0

Forum statistics

Threads
1,215,160
Messages
6,123,355
Members
449,097
Latest member
thnirmitha

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