SOLVED

XLOOKUP to compare "Last Updated" of Container vs "Last Updated" of each of it's Contents

Copper Contributor

I'm looking to compare the last time a container was updated against the last time each of the items within said container were updated.

Each container can be filled with 1-10 items from a list of >200 items. If the items are revised, any container that has that item needs to be revised to have the most recent version replace the older version.

 

In one workbook, I have a sheet for "Containers" and a sheet for "Items" 

The Containers sheet looks something like this:

Update LogicContainer IDLocationLast_UpdatedItem_1Item_2Item_3
 0001Office 2042022-01-15RedBlueYellow
 0002Office 1012022-01-22GreenPurple 

 

The Items sheet looks something like:

Item_NameLast_Updated
Red2021-12-28
Blue2022-01-10
Yellow2022-01-25
Green2022-01-25
Purple2022-01-18

 

I used:

=IF([@[Last_Updated]]<XLOOKUP([@[Item 1]],Items[Item],Items[Last_Updated],,,1),"YES",IF([@[Last_Updated]]<XLOOKUP([@[Item 2]],Items[Item],Documents[Last_Updated],,,1),"YES",IF([@[Last_Updated]]<XLOOKUP([@[Item 3]],Items[Items],Items[Last_Updated],,,1),"YES","")

 

Which worked, but only if "Item" cells were all filled (which is often the case, but not strictly so) and if the Container "Last Updated" was less than one of the Items "Last Updated".

 

Both of the "Last Updated" columns will be manually entered. There is no logic in any cells other than the first column of the "Containers" sheet.

 

I'm hoping to find a solution that:

1. Returns the correct value for both up to date and out of date Containers.

2. Has more concise logic.

 

I'm trying to learn as many ways to go at a problem as possible and usually I can find a work around, but this one has me pretty stumped so I know I'm missing something. I'm just not sure what.

 

Thanks in advance.

2 Replies
best response confirmed by NathanAndrews (Copper Contributor)
Solution

@NathanAndrews 

That could be like

=IF( [@[Last_Updated]] <
          MAX(
             IFNA(
                INDEX( Items[Last_Updated],
                       XMATCH(Table1[@[Item_1]:[Item_3]], Items[Item_Name] )
                ),
             0 )
         ),
 "Yes", "No" )

 

@Sergei Baklan That did it! And I think I can piece together how and why. Thank you very much, Sergei!

1 best response

Accepted Solutions
best response confirmed by NathanAndrews (Copper Contributor)
Solution

@NathanAndrews 

That could be like

=IF( [@[Last_Updated]] <
          MAX(
             IFNA(
                INDEX( Items[Last_Updated],
                       XMATCH(Table1[@[Item_1]:[Item_3]], Items[Item_Name] )
                ),
             0 )
         ),
 "Yes", "No" )

 

View solution in original post