FILTER function to return ONLY records with most recent date

elcalvo

New Member
Joined
Dec 15, 2023
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I have been playing around with the question that @craigexcel had and where @Fluff and @JamesCanale had their valuable input, I just cannot crack this nut.

  • I'm using Office 365
  • I have a sheet with headers and its data below. The data is named exampledata (headers in row 2; data in A3:L12
  • In another sheet, I want a formula that filters on "Meeting" in column F (Type) so it returns only rows with "Meeting" and only shows the most recent date as per column G (Last)
In one attempt (on the original data, not the example data), it returned almost what I wanted but for the most recent dates. It gave at least unique values for the Company.

When trying to reproduce in an example, it returns only one line.

The formula I am using is:

=LET(
z, exampledata,
a, FILTER(z, INDEX(z, , 6) = "Meeting"),
b, SORT(SORT(a, 4, ), 7, ),
c, TAKE(DROP(b, , 7), , 1),
d, VSTACK(DROP(c, 1), 0),
e, c <> d,
result, FILTER(b, e),
result
)


Any suggestions as to how to adjust the formula to return the desired results? I appreciate your time at having a look at this.
Example data
#PartnerClassCompanyProductTypeLastPrioXNextDueAction/notes
1Partner 1OtherCompany AOtherMeeting31/01/20231TRUE02/02/2023xNotes 1
4Partner 1OtherCompany AOtherMeeting22/03/20231TRUE24/03/2023Notes 2
34Partner 2OtherCompany DOtherMeeting09/07/20231TRUE09/07/2023xNotes 3
33Partner 3OtherCompany EOtherAction09/07/20231TRUE09/07/2023Notes 4
35Partner 2OtherCompany FOtherMeeting11/07/20231TRUE13/07/2023Notes 5
42Partner 2OtherCompany DOtherMeeting23/07/20231TRUE25/07/2023xNotes 6
46Partner 3OtherCompany GOtherMeeting04/08/20231TRUE04/08/2023Notes 7
47Partner 1OtherCompany AOtherAction04/08/20231TRUE04/08/2023Notes 8
48Partner 1OtherCompany BOtherAction06/08/20231TRUE06/08/2023xNotes 9
206Partner 1OtherCompany COtherMeeting01/12/20231TRUE06/08/2023Notes 10
Expected result
#PartnerClassCompanyProductTypeLastPrioXNextDueAction/notes
4Partner 1OtherCompany AOtherMeeting22/03/20231TRUE24/03/2023Notes 2
35Partner 2OtherCompany FOtherMeeting11/07/20231TRUE13/07/2023Notes 5
42Partner 2OtherCompany DOtherMeeting23/07/20231TRUE25/07/2023xNotes 6
46Partner 3OtherCompany GOtherMeeting04/08/20231TRUE04/08/2023Notes 7
206Partner 1OtherCompany COtherMeeting01/12/20231TRUE06/08/2023Notes 10
Current result
#PartnerClassCompanyProductTypeLastPrioXNextDueAction/notes
206Partner 1OtherCompany COtherMeeting01/12/20231TRUE06/08/2023Notes 10
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
How about
Excel Formula:
=LET(f,SORT(FILTER(A3:L1000,F3:F1000="meeting"),10,-1),r,ROWS(f),SORT(FILTER(f,MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(INDEX(f,,4)=TOROW(INDEX(f,,4))),SEQUENCE(r,,,0))=1)))
 
Upvote 0
Or perhaps:

Excel Formula:
=LET(
z, exampledata,
a, FILTER(z, INDEX(z, , 6) = "Meeting"),
uc, UNIQUE(INDEX(a,0,4)),
b, SORT(SORT(a, 4, ), 7,-1 ),
c,INDEX(b,0,4),
result,REDUCE("",uc,LAMBDA(a,i,VSTACK(a,TAKE(FILTER(b,c=i),1)))),
DROP(result,1)
)
 
Upvote 0
Solution
both work absolutely fine ! OMG, thanks a million

I will now go and see if I understood what you both did to learn from it
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Please do not mark as post as the solution, when it doesn't contain one. Thanks
You can mark either post#2 or 3 as the solution if you wish.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,952
Members
449,095
Latest member
nmaske

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