TRaP
Moderator
Inregistrat: acum 7 ani
Postari: 802
|
|
You can even enhance the above to display the results sorted in a desired order rather than alphabetically.
For example, I have a formula returning some units of measurement, one to five depending on material. I want to sort them as "KG", "M3" then don't care about the remaining 3 (don't even know what they when I make the formula).
=TRANSPOSE(SORTBY( UNIQUE(FILTER($E$7:$E$1000;IFERROR($H$7:$H$1000=J7;FALSE))); IF(ISNUMBER(MATCH(UNIQUE(FILTER($E$7:$E$1000;IFERROR($H$7:$H$1000=J7;FALSE))); {"KG";"M3"}; 0)); 1; 2)))
UNIQUE(FILTER($E$8:$E$589;IFERROR($H$8:$H$589=J7;FALSE))) gets the filtered list.
MATCH(...; {"KG";"M3"}; 0) checks if each value is in the priority list: - If it's found, ISNUMBER(MATCH(...)) returns TRUE, and IF(...; 1; 2) assigns priority 1. - If it's not found, it gets priority 2 (lower priority).
SORTBY(...; IF(...)) sorts with priority: - "KG" and "M3" first (priority 1) - The rest appear in any order (priority 2)
Source: ChatGPT
|
|