Hi,
I'm hoping someone can help me with this query.
I'm struggling to dynamically filter a table by a list of the Unique names and return the entire row from the table where the Date is the Max date.
I have a formula that filters as expected if I copy it down, however I really need this to be dynamic as the number of names will vary
=LET(dta, FILTER(Table1,(Table1[Name]=H5)),FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))))
My problems arise when I try to use it in a Lambda to dynamically process each row of the unique names.
I'm clearley not understanding something fundamental when using Byrow or Map with a Lambda to Filter rowsbased on multiple criteria.
Here's an eaxmple of the data, Table1 has these columns:
The unique list of names in H5:
=UNIQUE(Table1[Name])
and the expected result:
This attempt produces a #CALC! error, same if I use Byrow
=MAP(H5#,LAMBDA(r,LET(dta, FILTER(Table1,(Table1[Name]=r)),x,FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))),
x)))
This produces the correct reuslts, but all text is concatenated in a single cell in one column:
=MAP(H5#,LAMBDA(r,LET(dta, FILTER(Table1,(Table1[Name]=r)),x,FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))),
ARRAYTOTEXT(x))))
John Doe, 100, 44927, 31
Jane Smith, 101, 44562, 46
Richard Roe, 102, 44927, 40
And any attempts to Splittext produce errors.
What am I missing?
I'm hoping someone can help me with this query.
I'm struggling to dynamically filter a table by a list of the Unique names and return the entire row from the table where the Date is the Max date.
I have a formula that filters as expected if I copy it down, however I really need this to be dynamic as the number of names will vary
=LET(dta, FILTER(Table1,(Table1[Name]=H5)),FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))))
My problems arise when I try to use it in a Lambda to dynamically process each row of the unique names.
I'm clearley not understanding something fundamental when using Byrow or Map with a Lambda to Filter rowsbased on multiple criteria.
Here's an eaxmple of the data, Table1 has these columns:
Name | ID | Date | Rate |
John Doe | 100 | 01/01/2022 | £27 |
John Doe | 100 | 01/06/2020 | £24 |
John Doe | 100 | 01/01/2021 | £25 |
John Doe | 100 | 01/01/2023 | £31 |
John Doe | 100 | 07/10/2019 | £22 |
Jane Smith | 101 | 19/03/2020 | £38 |
Jane Smith | 101 | 01/01/2021 | £40 |
Jane Smith | 101 | 01/01/2022 | £46 |
Richard Roe | 102 | 01/05/2019 | £35 |
Richard Roe | 102 | 01/05/2018 | £34 |
Richard Roe | 102 | 29/08/2017 | £33 |
Richard Roe | 102 | 01/01/2023 | £40 |
Richard Roe | 102 | 01/01/2022 | £38 |
Richard Roe | 102 | 01/01/2021 | £37 |
The unique list of names in H5:
=UNIQUE(Table1[Name])
Unique Names |
John Doe |
Jane Smith |
Richard Roe |
and the expected result:
Name | ID | Date | Rate |
John Doe | 100 | 01/01/2023 | 31 |
Jane Smith | 101 | 01/01/2022 | 46 |
Richard Roe | 102 | 01/01/2023 | 40 |
This attempt produces a #CALC! error, same if I use Byrow
=MAP(H5#,LAMBDA(r,LET(dta, FILTER(Table1,(Table1[Name]=r)),x,FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))),
x)))
This produces the correct reuslts, but all text is concatenated in a single cell in one column:
=MAP(H5#,LAMBDA(r,LET(dta, FILTER(Table1,(Table1[Name]=r)),x,FILTER(dta,INDEX(dta,,3)=MAX(INDEX(dta,,3))),
ARRAYTOTEXT(x))))
John Doe, 100, 44927, 31
Jane Smith, 101, 44562, 46
Richard Roe, 102, 44927, 40
And any attempts to Splittext produce errors.
What am I missing?