Forum Discussion
kittenmeants
Sep 07, 2023Brass Contributor
Index and Sort formula help
Hello! I need help modifying this formula to accommodate the new year, 2024. So this is what the table currently looks like(small version), and I am pulling this information to a separate ta...
- Sep 07, 2023
PeterBartholomew1
Sep 07, 2023Silver Contributor
This would do the two years in a straightforward manner but if you wanted an array of years that would be a little more challenging. The year 2024 only requires
= LET(
ordered, SORT(table,2,-1),
TAKE(ordered, n)
)but to extend the formula to include 2024 would require
= LET(
table2023, HSTACK(TransactionType, Year2023),
table2024, HSTACK(TransactionType, Year2024),
ordered2023, SORT(table2023,2,-1),
ordered2024, SORT(table2024,2,-1),
TAKE(HSTACK(ordered2023, ordered2024), n)
)