Sum up Numbers in one column if there is a specific selection in another column

Hi Community,

I have a problem which seemed to be simpel but I don’t get any further after trying several formulas.

I have one table with one column with number of holidays and another column with their stage (3 possible).

In another table I have 3 columns for these stages and just want to get a the sum of the first table but only for the specific stage.

Unbenannt

I know there is a solution in Excel but how is the formula in Coda for that?

Kind regards

Mario from Germany

HI Mario,

Here is an example using sumIf():

You could also click on the link to sum() and make use of it in conjunction with a filter().

Hope this helps.
Piet

Thanks for your reply,

unfortunately I already tried SumIf and Filter but something seems to be missing.

For example when I try the following formulas, it searches in the “Stage” column if there is a “planed” somewhere, and if so, it sums up the whole column “Holidays” and gives me 26 as result. But I expect as result 13 because only these Holidays are in Stage “planed” …

a) t_urlaubs_planung.Holidays.SumIf(t_urlaubs_planung.Stage.Contains(planed))

b) t_urlaubs_planung.Holidays.SumIf(t_urlaubs_planung.Stage.Filter(planed))

Any idea what the right formula is to get this working?

Hello @Mario_Kiessling

This is very easy to do correctly - please make and share a dummy doc in which we can show you the solution.

There is more than one way to do this, but the formulas could look something like:
TableName.filter(currentvalue.Stage=@requested).Holidays.sum()

Or even simpler: make a view of your table, group on Stage and show the sum() of Holidays.

I don’t like SumIf, but I guess that could work too.

Greetings, Joost

2 Likes

Hello Joost!

TableName.filter(currentvalue.Stage=@requested).Holidays.sum()

That was the right formula and it works perfectly!

Thank you!

Greets from Germany

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.