Tally up all check boxes in a row

Is there a way for me to write a formula that can add how many checkboxes are checked “true” in a row, without just manually counting them all?

Hi @Sarah_Arminta :slight_smile:
Yes there is one for sure!
You should be able to filter just the ones who are “true” and count() them :slight_smile:
If you share a doc i can help you :slight_smile:

Hi @Sarah_Arminta ,

This post talks about the same issue:

https://community.coda.io/t/checkbox-count-in-a-table/6395

I tried to recreate @Nick_HE 's solution:

To count the checkboxes in the row, you can actually just add them up.
=CheckboxColumn1 + CheckboxColumn2 + CheckboxColumn3

here, but ran into an interesting condition where it works in one row but not another:

Rule of the thumb: do not rely on JavaScript’s implicit type conversions.

image

The culprit in your specific case is blank values, neither true nor false, you can see them as more pale checkboxes:
image

1 Like

Aha, the blanks!

A somewhat clunky solution that comes to mind is:

IF(A,1,0) +
IF(B,1,0) +
IF(C,1,0) +
IF(D,1,0) +
IF(E,1,0) +
IF(F,1,0) +
IF(G,1,0) +
IF(H,1,0) +
IF(I,1,0) +
IF(J,1,0)

For each column, we ask “Is the column true?” note: IF(A, is a shorthand for IF(A=true,
If it is true, spit out a 1. Otherwise (i.e. if false or blank), spit out a 0.
And then add the next column’s result.

Edit: And then @Mario 's solution looks something like this I expect:

List(A,B,C,D,E,F,G,H,I,J).Filter(currentValue=true).Count()

Hey @Nick_HE, to be honest i misread the “row” part, or i would have preferred to change how the data are organized in the doc instead of trying to do this, but now that we are here :slight_smile:
in this case i would use buttons with different “name” based on his value instead of checkboxes, like " :x: " or “:heavy_check_mark:”, but it would need a way to record the change, so it depends on how many column you need to count
also, your formula with list and filter seems a working solution! :slight_smile:


@Paul_Danyliuk Isn’t enough to set “new rows value” to “false” in the columns to fix this?


@Johg_Ananda If they are selected at least once, that is enough to change them from blank, to at least “false”
Then the formula work!
And so, hopefully, changing the default value for new rows of checkboxes columns should be enough to fix it!