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.