- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 25, 2020 08:13 AM
I’ve had to do this quite a few times… my old solution was:
- Rollup with ARRAYUNIQUE(values)
- Remove any trailing ','s in another column
- Count the remaining commas, +1
Now I do it all inside the rollup with the following snippet:
https://gist.github.com/RussellBishop/153d70be56ec5d8983439b6d9cf1279f
airtable-count-unique-array-rollup
IF((values),
LEN(
IF(
FIND(",", ARRAYJOIN(ARRAYUNIQUE(values), ",")&"") = 1,
SUBSTITUTE(ARRAYJOIN(ARRAYUNIQUE(values), ",")&"", ",", "", 1),
IF(
FIND(",", ARRAYJOIN(ARRAYUNIQUE(values), ",")&"", LEN(ARRAYJOIN(ARRAYUNIQUE(values), ",")&"") - 1),
This file has been truncated. show original
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.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 10, 2022 09:04 AM
If there might be empty values, you could use
COUNTA(ARRAYUNIQUE(values))
instead of
COUNTALL(ARRAYUNIQUE(values))
The differences between COUNTA()
and COUNTALL()
are documented in the formula field reference. COUNTALL()
counts all values, including blanks. COUNTA()
does not count blanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 02, 2022 08:25 AM
Doesn’t work:
COUNTALL(ARRAYUNIQUE(values))
for
Rollup fields aren’t an option for other rollups, so in my case, trying to count the unique values in the rollup field won’t work. I have the above in a formula field and it only returns a 1.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 02, 2022 08:48 AM
You probably need a rollup of a lookup with ARRAYFLATTEN
. It is hard to tell without a deeper dive into your schema.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 22, 2022 02:44 AM
This is nice @Collin_Schwantes, I like the [^,]
For a rollup you’d need to convert it into a string and add the separators
IF(
LEN(ARRAYJOIN(ARRAYUNIQUE(values),',')&"") > 0,
LEN(REGEX_REPLACE(ARRAYJOIN(ARRAYUNIQUE(values),',')&"","[^,]",""))+1,
0)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 20, 2024 01:48 PM
Hi Russell,
This is the solution that I am looking for but it isn't returning the right number, I think because the values I'm trying to count have a comma in them. Would this be why and would you suggest how to fix? I am not a coder so modifying your code is difficult for me.
Debbie

- « Previous
-
- 1
- 2
- Next »