Dynamically listing all unique values in Column
Hello,
I'm building pivot tables and need to dynamically list all the unique values from a column.
On my "formulas" sheet (not data sheet) I have INDEX(DISTINCT({SAO Range 1}), 1)
This works, however, I have to manually put in the formulas down the rows like such:
INDEX(DISTINCT({SAO Range 1}), 1)
INDEX(DISTINCT({SAO Range 1}), 2)
INDEX(DISTINCT({SAO Range 1}), 3)
...etc
Currently there are 5 unique values from 50 entries (these are mo/yr btw), but the list WILL grow.
I've inserted this formula up to INDEX(DISTINCT({SAO Range 1}), 25) with everything beyond 5 resulting in the expected (#INVALID VALUE)
In Excel I can use the "Unique" function and it will auto list the uniques, however, many dynamically. Is there a way to do the same in SS?
Thanks for any help with this
Best Answers

The way I sort of workaround this is to create a helper "Row Number" column and populate X numbers of rows with 1X (so if I need 300 rows I just type in a few numbers and then drag so that it autoincrements).
Then in my Index formula for the index number I put [Row Number]@row. Then at least you have a column formula:
INDEX(DISTINCT({SAO Range 1}), [Row Number]@row)
Not exactly what you're looking for but I don't know of another way to do it more efficiently, personally.

@BrianDN  good point, I forgot to add that part! I do an iferror to get around that and my count works properly. =iferror(INDEX(DISTINCT({SAO Range 1}), [Row Number]@row), "")
The count will only grab populated rows and you won't get all those errors.
Answers

The way I sort of workaround this is to create a helper "Row Number" column and populate X numbers of rows with 1X (so if I need 300 rows I just type in a few numbers and then drag so that it autoincrements).
Then in my Index formula for the index number I put [Row Number]@row. Then at least you have a column formula:
INDEX(DISTINCT({SAO Range 1}), [Row Number]@row)
Not exactly what you're looking for but I don't know of another way to do it more efficiently, personally.

Thanks Eric,
Yeah, that would make it possible to drag the formula, but another issue I have is the Invalid Value error, which when I reference the uniques along with the sumif for their frequency, the dashboard shows the errors count along with the actual values.
Anyway, I will mark this as answered as it does help and I appreciate you taking the time to give me the tip.

@BrianDN  good point, I forgot to add that part! I do an iferror to get around that and my count works properly. =iferror(INDEX(DISTINCT({SAO Range 1}), [Row Number]@row), "")
The count will only grab populated rows and you won't get all those errors.

Hey @BrianDN
Eric provided the best workaround for the native smartsheet application. If your license has access to Smartsheet premier apps pivot app or datamesh, there are other possible solutions. If you could tolerate a copy row to the other sheet with the additional columns that would bring, this might also be a solution. And lastly, if you were only needing to display the data in a tabular format on a dashboard, you might be able to use a summarized report.

I'll play with it later today using both of your insights.
As of now how have to say I'm extremely impressed with the community here and the response rate

I tried this but didnt work for me. Please help what I am doing wrong. I have column [PAYROLL HANGER] which has names sparsely filled in down 500 rows. SO some rows are blank and some have names. I created a helper column with X1, X2, X3… X500 all the way down the side of the data column. I then took your formula and applied it and I get incorrect argument.
I want the result to be every distinct name in the [PAYROLL HANGER] column.
Do you see what I am doing wrong?
Where should I place your formula, maybe I am not placing it into the sheet properly.
I would like to place it down at row 600 in a totally unrelated column and have it list from there down. I dont want to create a new column for the results if I dont have to.
=IFERROR(INDEX(DISTINCT([PAYROLL HANGER]:[PAYROLL HANGER], [PAYROLL HANGER ROW]@row), ""))
Thank you!

I found this that works but requires dedicated column for results:
=IFERROR(INDEX(DISTINCT(COLLECT([PAYROLL HANGER]:[PAYROLL HANGER], [PAYROLL HANGER]:[PAYROLL HANGER], NOT(ISBLANK(@cell)))), INDEX@row), "")
Used a simple numerical index column and formula has to be placed into dedicated column the results will start at whatever row the index number 1 starts on.
Help Article Resources
Categories
 All Categories
 14 Welcome to the Community
 Smartsheet Customer Resources
 61.3K Get Help
 321 Global Discussions
 197 Industry Talk
 416 Announcements
 4.2K Ideas & Feature Requests
 126 Brandfolder
 153 Just for fun
 124 Community Job Board
 441 Show & Tell
 26 Member Spotlight
 1 SmartStories
 278 Events
 34 Webinars
 7.3K Forum Archives
Check out the Formula Handbook template!