Help

Re: Counting linked records in the same table

2186 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Maria
7 - App Architect
7 - App Architect

Hi Can anyone help please? I am trying to find a way to count linked records in the same table I think someone may have found a work around but am going around in circles trying to find anything I can understand.

Thanks, Maria

11 Replies 11
Katherine_Duh
Airtable Alumni (Retired)

Hi folks. Lookup, rollup, and count fields now support looking up, rolling up, and counting from a linked record field that has been linked to its own table. Hopefully this will make things easier for you, @Maria! Going to put an auto-closing timer on this topic.

liortalmor
4 - Data Explorer
4 - Data Explorer

I've actually gone ahead and built the full formula, for anyone who's still adventurous enough 😛

The following formula will return the number of Linked records in a Linked record field called "LinkedRecordsField":

 

IF(LinkedRecordsField,IF(LEN(SUBSTITUTE(ARRAYJOIN(LinkedRecordsField)
,',',''))=LEN(ARRAYJOIN(LinkedRecordsField)),1,(LEN(ARRAYJOIN(LinkedRecordsField))-LEN(SUBSTITUTE(ARRAYJOIN(LinkedRecordsField),',','')))+1),0)

 

The first IF condition checks if the field is empty and returns '0' if indeed the field is empty, otherwise we go ahead to the second IF condition, which checks if there's only 1 record within the field, by comparing between the length of characters within the ARRAYJOIN() formula and the the length of characters within the ARRAYJOIN() formula while omitting any commas. Since the presence of only 1 record would not have any commas, the formula would return 1 in this case. Otherwise, the formula subtracts the Length of ARRAYJOIN()  by the kength of ARRAYJOIN() while omitting commas, and returns the result + 1, which is the exact number of linked records in the field 🙂

Now THAT WAS FUN! Good luck everyone 😄