Forum Discussion
Return unique values in one column but with duplicate entries in another column for Excel
- Mar 10, 2022
Detlef_Lewin Hi.
With Excel 365 robywoo's formula can be extended to spill the resulting table from one cell, L2.
The attached file has it built in three steps.
The LET functions makes it possible to use helper columns in the same formula.
Changing the last parameter from the final output to eg IDs is a way to debug or analyse such formula.
=LET(IDs;UNIQUE(C:C); counter;BYROW(IDs;LAMBDA(id;COUNT(UNIQUE(FILTER(A:A;C:C=id))))); includingLabels;CHOOSE({1\2};counter;IDs); output;INDEX(includingLabels;SEQUENCE(ROWS(includingLabels)-2;;2);SEQUENCE(;COLUMNS(includingLabels))); output )You could also add more functionality like changing row 5 to
SORT(output) or SORT(output,2) to sort by first or second column.
NB - my Excel uses national settings ; as delimiter between parameters instead of US ,
Easiest to use the attached file.
Hi robywoo
I assumed it was something like that and also think that Detlef_Lewin formula meets your needs.
The previously attached table in column L:M above does the same but for everyone at once.
Download the file, change to you actual data in columns A:C. It should already do what you want.
bosinander I just tried the formulas in columns E:F (because it looks easier to understand than L:M on the existing data set but against the first entry eg 1234 the result is 0. It is like it is one row out. If I slide it up it matches the correct answer to the corresponding ID. I entered a fixed array rather than the whole column in the formula