This is a cool concept and fairly straightforward. Each attachment is separated by a comma. So, you can count the number of commas in the Attachment field to see how many attachments there are. See this example. Hope it helps!
Wow this is perfect, thank you @VictoriaPlummer! I was able to copy the base you provided and adapt the formulas to my fields.
Oh shoot @VictoriaPlummer I spoke too soon. Looks like it is still counting records with no attachments as having 1 attachment. It’s also doubling the count in some instances; for example, a record with 5 videos attached is being counted as having 10 attachments. Any ideas?
Edit: The second issue with things being counted twice was due to commas in the file name. Still have the first one though with zero attachments being counted as 1.
Oh shoot @VictoriaPlummer I spoke too soon. Looks like it is still counting records with no attachments as having 1 attachment. It’s also doubling the count in some instances; for example, a record with 5 videos attached is being counted as having 10 attachments. Any ideas?
Edit: The second issue with things being counted twice was due to commas in the file name. Still have the first one though with zero attachments being counted as 1.
Oh yeah that will happen in the way that the formula is structured. You can throw an IF statement around the existing formula to test for IF an attachment exists, then run the formula, otherwise return 0
Oh shoot @VictoriaPlummer I spoke too soon. Looks like it is still counting records with no attachments as having 1 attachment. It’s also doubling the count in some instances; for example, a record with 5 videos attached is being counted as having 10 attachments. Any ideas?
Edit: The second issue with things being counted twice was due to commas in the file name. Still have the first one though with zero attachments being counted as 1.
Just test to make sure the Attachments field isn’t empty first.
IF(
Attachments=BLANK(), 0,
LEN(Test)-LEN(SUBSTITUTE(Test,",",""))+1
)
NOTE: I’m rewriting here the formula in the Test field in Victoria’s example, in which the Test field correctly counting attachments unless there aren’t any. The formula above fixes that.
William
@VictoriaPlummer and @WilliamPorterTech yall rock! Thank you so much for the help, got it all working in my base.
Just test to make sure the Attachments field isn’t empty first.
IF(
Attachments=BLANK(), 0,
LEN(Test)-LEN(SUBSTITUTE(Test,",",""))+1
)
NOTE: I’m rewriting here the formula in the Test field in Victoria’s example, in which the Test field correctly counting attachments unless there aren’t any. The formula above fixes that.
William
Hello William,
Thank you for sharing the formula to count the number of attachments. I assume the "Test" field is a formula field referencing the attachments field, which is named "Attachments" in this context. I applied it to my Airtable base and found that, in some cases, the formula field shows a higher number of attached files than the actual number in the attachment field. For example, a record in my database contains only 3 files, but the formula field indicates 6 files instead of 3. Another case is that a record in the same base of mine stores only one attached file, but the same formula field indicates 2 files.
In my context, the attachment field is named "Supporting Documents." I created an additional field called "Test," with the formula {Supporting Documents} referencing the "Supporting Documents" field. The formula I adapted based on your original suggestion is:
IF({Supporting Documents}=BLANK(), 0, LEN(Test)-LEN(SUBSTITUTE(Test, ",", ""))+1)
Could you please help me fix the issues mentioned?
Thank you