Forum Discussion
mswartzentruber
Oct 04, 2024Copper Contributor
Excel Dynamic Array - Resetting a Row Count
Sharing a problem and solution which I believe might be helpful. I've been working for a while on coming up with a way to sort and rank a list of customer / item / other identifier fields which a...
Patrick2788
Oct 04, 2024Silver Contributor
Two ways to do it depending on your setup.
with a table:
=LET(k, COUNTIFS($B$2:B2, B2, $C$2:C2, C2), B2 & "-" & C2 & "-" & k)
with dynamic array:
=LET(
i, SEQUENCE(ROWS(customer)),
counter, LAMBDA(i, each_customer, each_item,
LET(
k, COUNTIFS(TAKE(customer, i), each_customer, TAKE(item, i), each_item),
each_customer & "-" & each_item & "-" & k
)
),
MAP(i, customer, item, counter)
)
The second option is more exciting but the first option may be more sensible if the customer data is being used as data entry primarily.