Help

Re: Count total array value in linked record field to return integer

450 0
cancel
Showing results for 
Search instead for 
Did you mean: 
jpsalley
4 - Data Explorer
4 - Data Explorer

New to all of this. No coding background; small business owner. I am trying to create a rudimentary inventory system with Airtable.

 

I can't figure out how to get a formula to "count" the number of array entries in a linked record field, and return back a simple integer value.

 

For example, in the photo attached, the "Reserved" field should return the value of "2," since there are two entries in the linked record field.

 

Any ideas? Thanks.

 

Screenshot 2024-10-04 at 1.02.20 PM.png

3 Replies 3

Use a Count field instead of a formula field.

Hi,
The best way is to use Airtable native Count field type, as @kuovonne said. It has built-in filter that allows you to count only links to records matching some condition in a linked table. Count, Lookup and Rollup are three field types whose results computed based on a value of a linked field.

If, for some reason, you need exactly formula solution, you can use

(Field!='')+LEN(Field)-LEN(SUBSTITUTE(Field,',',''))

Note that it's less reliable way, when comma presents in link text, it is counted too.

If for some reason you need a formula solution, use a rollup field instead, with the appropriate COUNT() function, probably COUNTALL(values). This is more reliable than Alexey's formula when there are commas in the text. Whatever other parts of the formula you want in the formula field you can also include in the rollup formula.

Although rollup fields are more complex than formula and count fields, they are really powerful and are worth learning if someone wants to master Airtable.

However, the original poster was "New to all of this" and a "small business owner" who is probably trying to do a zillion other things. So, I thought a simpler solution was better for a novice.

There are many ways to do things in Airtable, use what makes sense to you at the time!