Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here
Nov 21, 2021 11:47 PM
Its probably a simple formula…but here goes…
I have a record in airtable that looks like this:
The A, B, C represent the responses to survey
What I want to do is COUNT the number of each letter - so for example
A = 3
B = 1
C = 2
E = 1
I have got as far as: IF({Col1}=‘A’,1,0) and that returns the 1 (in this example)
What does the formula look like to check in Col2 - Col7 contains ‘A’ and then give me the total of 3?
I hope that explains what I am trying to do clearly :grimacing: :nerd_face:
Thanks in advance.
Solved! Go to Solution.
Nov 22, 2021 02:23 PM
Dimitris’s formula has some curly braces out of order and his field names do not match your base. Here is his formula rewritten with the curly braces in the proper place and field names/values changed to match your screen shot. Note that you will still need to extend the formula to include all the desired columns.
SUM(
IF({Activity 1}='A',1,0),
IF({Activity 2}='A',1,0),
IF({Activity 3}='A',1,0)
)
Nov 22, 2021 12:39 AM
Hey @AJTech,
You try the following in Total (A):
sum(if({Col1='a',1,0}),if({Col2='a',1,0}),if({Col3='a',1,0}))
Does it work for you?
Yours sincerely,
Dimitris Goudis
Nov 22, 2021 02:12 PM
Unfortunately not returns “invalid formula”
Nov 22, 2021 02:23 PM
Dimitris’s formula has some curly braces out of order and his field names do not match your base. Here is his formula rewritten with the curly braces in the proper place and field names/values changed to match your screen shot. Note that you will still need to extend the formula to include all the desired columns.
SUM(
IF({Activity 1}='A',1,0),
IF({Activity 2}='A',1,0),
IF({Activity 3}='A',1,0)
)
Nov 22, 2021 02:30 PM
Here is another approach that will make it easier of you end up changing the number of activities.
Have an {AllResponses} formula field that concatenates the values of all the activity responses into one field
CONCATENATE(
{Activity 1},
{Activity 2},
{Activity 3},
{Activity 4},
{Activity 5},
{Activity 6},
{Activity 7}
)
Then have different fields that counts the number of times a particular letter appears in that formula field.
LEN({AllResponses}) - LEN(SUBSTITUTE({AllResponses}, "A", ""))
This way if you add/remove activities, you only need to edit the {AllResponses} formula.
Nov 22, 2021 04:41 PM
Simple and elegant solution @kuovonne thank you - works perfectly :white_check_mark: :white_check_mark: