Getting sum of more than 2 columns of a row in another column

I am trying to add 8 (checkbox) columns.

What would be the best way to do it?

Currently Coda doesn’t allow me to reference more than 2 columns when I am trying to do the sum. So I added some more temp (hidden) columns to do the sum in parts and them combine it in two steps …

Hopefully there are better ways to do it :slight_smile:

https://coda.io/@trader-umr/demonfinder

OK @trader_umr I’ve got two solutions for you.

  1. You can use the ‘Scale’ type column instead of checkbox. Set the max value to 1, and then these will function as numbers which can be summed as opposed to boolean values (true/false).

  2. The other option, if you want to stick with checkboxes, is to nest several if()'s into your formula like so:

sum(if(thisRow.1,1,0),if(thisRow.2,1,0))...

This way you are converting each boolean to an integer. Hope this helps!

1 Like

@trader_umr

Clever technique to set sliders as booleans. @Johg_Ananda

Here’s another approach to throw in the mix:

CountIf(
  List(thisRow.one,thisRow.two,thisRow.three,thisRow.four),
  CurrentValue=true
)
5 Likes

@Ander ah very clever! I think your solution is more elegant. Well done sir :slight_smile:

2 Likes

Very classy, @Ander!

2 Likes

You rock! Cheers mate.

1 Like

Just amazing @Ander and @Johg_Ananda :clap:

:exclamation: Great community activity, showing such a creativity in approaching challenges and giving the chance to learn form each other perspectives :exclamation:

4 Likes