# Calculating the total number of 'letters' in a record

Topic Labels: Formulas
Solved
1428 6
cancel
Showing results for
Did you mean:  5 - Automation Enthusiast

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:

1 Solution

Accepted Solutions  18 - Pluto

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)
)
``````
6 Replies 6  9 - Sun

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  5 - Automation Enthusiast

Unfortunately not returns “invalid formula”  18 - Pluto

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)
)
``````  18 - Pluto

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.  5 - Automation Enthusiast

Simple and elegant solution @kuovonne thank you - works perfectly :white_check_mark: :white_check_mark:  9 - Sun

Thanks for the correction @kuovonne :slightly_smiling_face: 