Reputation: 175
I have the following table on Excel from A2-A10
YEAR
1999
1997
1999
1998
1998
1996
1999
=INDEX(SORT(UNIQUE($A$2:$A$10)),COLUMN((A1))) >>> (drag formula horizontally)
This is my output:
1996 1997 1998 1999 0
The problem is that it keeps returning 0 because my range contains some blank cells. How can I ignore blanks using this formula?
Upvotes: 1
Views: 2897
Reputation: 3498
three possibilities:
=INDEX(SORT(UNIQUE(IF($A$2:$A$10<>"",$A$2:$A$10,LARGE($A$2:$A$10;1)))),COLUMN((A1)))
=INDEX(SORT(UNIQUE(FILTER($A$2:$A$10,$A$2:$A$10<>""))),COLUMN((A1)))
=IFERROR(1/(1/INDEX(SORT(UNIQUE($A$2:$A$10)),COLUMN((A1)))),"")
Upvotes: 1
Reputation: 11438
Or skipping INDEX so you don't need to drag your formula to the right:
=TRANSPOSE(SORT(UNIQUE(FILTER($A$2:$A$10,$A$2:$A$10<>""))))
Upvotes: 0