Count Unique Values in Rollup

I’ve had to do this quite a few times… my old solution was:

  1. Rollup with ARRAYUNIQUE(values)
  2. Remove any trailing ','s in another column
  3. Count the remaining commas, +1

Now I do it all inside the rollup with the following snippet:

And yes - I’m keeping it as a Gist on GitHub for easy access. I’ll be adding more of these gems as I go.

5 Likes

That’s awesome. How would you address the issue if some of the values being rolled up included a comma. In my example, a corporate name that included a comma (ie ABC Widgets, Inc.)?

1 Like

Oooph! Very interesting. I suppose you’d have to work from the fact that Airtable will always use a ‘,’ separator…

Perhaps you could make a column called Safe Corporate Name that replaces ','s found in your Corporate Names and replaces them with another character using SUBSTITUTE() – and then you can use this Rollup formula on that field instead.

Hope that helps.

1 Like