I would like to ask on how to convert this query to an arrayformula:
=query({unique(filter(A$2:A,B$2:B=B2)),sequence(rows(unique(filter(A$2:A,B$2:B=B2))))},"select Col2 where Col1 = '"&A2&"'")
I also attached this in a gsheet: https://docs.google.com/spreadsheets/d/1oFbGsP42fMphedY7wtZ7C3focVDJxxkVXHdf6aC3_D4/edit#gid=0
The idea is to count sequence number that will restart to 1 for the same item if month is different month (but it wont necessarily to crosscheck with month because thinking to concat to others but is still gonna be based on the unique id here)
try:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A&B2:B, SORT(SPLIT(FLATTEN(TRANSPOSE(
SPLIT(FLATTEN(QUERY(QUERY(QUERY({A2:A&B2:B&"×"&
VLOOKUP(A2:A, {A2:A, TEXT(ROW(A2:A), "00000")}, 2, ), B2:B},
"select max(Col1) group by Col1 pivot Col2"),
"offset 1", 0),,9^9)), " "))&"×"&SEQUENCE(COUNTUNIQUE(A2:A))), "×")), 3, )))