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

  • ericncarr
    ericncarr ✭✭✭✭✭
    Answer ✓

    @BrianDN

    The way I sort of workaround this is to create a helper "Row Number" column and populate X numbers of rows with 1-X (so if I need 300 rows I just type in a few numbers and then drag so that it auto-increments).

    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.

  • ericncarr
    ericncarr ✭✭✭✭✭
    Answer ✓

    @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

  • ericncarr
    ericncarr ✭✭✭✭✭
    Answer ✓

    @BrianDN

    The way I sort of workaround this is to create a helper "Row Number" column and populate X numbers of rows with 1-X (so if I need 300 rows I just type in a few numbers and then drag so that it auto-increments).

    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
    BrianDN ✭✭

    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.

  • ericncarr
    ericncarr ✭✭✭✭✭
    Answer ✓

    @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.

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭

    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.

  • BrianDN
    BrianDN ✭✭

    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

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!