You are viewing limited content. For full access, please sign in.

Question

Question

Calculate the sum of fields in table rows with a specific value set

asked on July 12, 2019

I have a table (Leave_Hours_Table) where employees can specify all leave taken (vacation, sick leave...). I would like to take all of the rows in that table where Leave_Type = Vacation and put the sum of the Hours for those rows in a single line field (Total_Vacation_Hours) outside of the table.

Can I do this using a field calculation or do I have to use JavaScript? 

0 0

Answer

SELECTED ANSWER
replied on July 15, 2019

You can use SUMIF to do it without JavaScript. It would be something like this, just swap the variables.

=SUMIF(Table.Leave_Type,"Vacation",Table.Hours)

 

Be sure to note that SUMIF and IF do not use the same formatting for the comparison.

1 0
replied on July 15, 2019

Thank you so much! I had tried SUMIF before, but I have to specify the value of Vacation (because I assigned values to the choices; 75 for "Vacation"), which I just tried and it worked. Much appreciated!

Here's what I had to use, since 75 is the value for the "Vacation" option in the drop down menu:

=SUMIF(Leave_Days_Table.Type,75,Leave_Days_Table.Hours)

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.