Formula for counting number of attachments


#1

I have a column of Attachment type. I want to create a formula based on the number of uploaded/attached files. How can I count the number of uploaded/attached files in that column?


#2

This is a clever trick suggested by @Simon_Brown: Given an Attachment field {Attached}, the formula to count the number of attachments is

IF(
LEN({Attached}=0,0,
LEN({Attached})-LEN(SUBSTITUTE({Attached},",",""))+1)

This works because Airtable casts {Attached} as a comma-separated string of concatenated RECORD_IDs. The formula then compares the length of the string with the length of the same string with commas removed (plus 1, to make sure single attachments get counted).


#3

This workaround works! Thanks!

Just a little of syntax typo (missing closing parenthesis for first LEN):

IF(
LEN({Attached})=0,0,
LEN({Attached})-LEN(SUBSTITUTE({Attached},",",""))+1)

#4

Thanks for the catch!