In Microsoft Excel, I have a table named TableTwo, with fields:
- tName
- dDate
- tStatus
tName is key-identifier of the records.
We extract a list of tName, named tNames, from table TableOne. Then for each tName in tNames, we want to find records from TableTwo that its dDate is the maximum value of corresponding records with this tName, and their tStatus is not Accepted.
TableOne
| tName | Category | startDate |
|---|---|---|
| asset1 | cat1 | |
| asset2 | cat1 | |
| asset3 | cat1 | |
| asset4 | cat2 | |
| asset5 | cat3 |
TableTwo
| tName | dDate | tStaus |
|---|---|---|
| asset1 | 14010201 | Accepted |
| asset1 | 13990304 | Accepted |
| asset2 | 14010420 | Accepted |
| asset3 | 14020512 | Accepted |
| asset1 | 14030305 | Rejected |
| asset1 | 14030306 | Accepted |
| asset1 | 14030307 | Postponed |
| asset2 | 14030307 | Rejected |
| asset3 | 14030307 | Accepted |
| asset4 | 14030307 | Accepted |
| asset4 | 14030308 | Rejected |
| asset5 | 14030309 | Accepted |
| asset2 | 14030310 | Accepted |
| asset2 | 14030311 | Rejected |
Final Results:
| tName | dDate | tStatus |
|---|---|---|
| asset1 | 14030307 | Postponed |
| asset2 | 14030311 | Rejected |
I've tried to use LET and Filter function, first finding tNames, then inspecting TableTwo to find records that met criterias.

Attempt 1 — Output: #N/A
=LET(
tNames, FILTER(TableOne[tName],(TableOne[Category]="cat1"),"NoAsset"),
dDates, TableTwo[dDate],
tStatuses, TableTwo[tStatus],
maxDates, MAXIFS(TableTwo[dDate], TableTwo[tName], tNames),
result, IF((TableTwo[dDate]=maxDates)*(TableTwo[tStatus]<>"Accepted"), TableTwo[tName], ""),
FILTER(result, result<>"")
)
Attempt 2 — Output: #Value!
=LET(tNames,FILTER(TableOne[tName],(TableOne[Category]="cat1"),"NoAsset"),
cntr, SEQUENCE(ROWS(tNames)),
rngTwo,FILTER(tNames,(TableTwo[tName]=INDEX(tNames,cntr))*(TableTwo[dDate]=MAXIFS(TableTwo[dDate],TableTwo[tName],INDEX(tNames,cntr)))*(TableTwo[tStatus]<>"Accepted")),
r,SEQUENCE(ROWS(rngTwo)),
output,INDEX(rngTwo,r),
output)

