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

Question

Question

Calculate amount based if checkbox is checked in table

asked on August 1, 2024 Show version history

I have a table that has an amount and a checkbox next to it that says refunded. I need to be able to calculate a value based off if that refunded checkbox is checked. I've attached a screenshot below. 

 

0 0

Answer

SELECTED ANSWER
replied on August 1, 2024 Show version history

Sorry - I assumed you were working on a calculation in each row.

If you are doing a calculation outside the table, then a function like SUMIF would probably work.  Here's an example: 

=SUMIF(table_variable.checkbox_variable.checkbox_value, FALSE, table_variable.amount_value)

This is saying to sum up all amounts from the table on rows where the checkbox is not marked.

EDIT TO ADD: Help Documentation on Formulas in Forms 11

0 0

Replies

replied on August 1, 2024

You should be able to use the IF and INDEX functions to check if the checkbox is marked, and then complete a calculate if it is true or an alternate calculation if it is false.

It'll look something like this: 

=IF(INDEX(table_variable.checkbox_variable.checkbox_value, ROW()), INDEX(table_variable.amount_variable, ROW())*-1,INDEX(table_variable.amount_variable, ROW()))

This is saying - if the checkbox on this row is marked, the take the amount from this row and multiply it by -1, otherwise take the amount from this row and don't change it.

0 0
replied on August 1, 2024

I have a box with a grand total amount. The sum would be calculated based off if the box was checked "Refunded". Would this still work?

0 0
SELECTED ANSWER
replied on August 1, 2024 Show version history

Sorry - I assumed you were working on a calculation in each row.

If you are doing a calculation outside the table, then a function like SUMIF would probably work.  Here's an example: 

=SUMIF(table_variable.checkbox_variable.checkbox_value, FALSE, table_variable.amount_value)

This is saying to sum up all amounts from the table on rows where the checkbox is not marked.

EDIT TO ADD: Help Documentation on Formulas in Forms 11

0 0
replied on August 1, 2024

That worked. Thank you! 

1 0
replied on August 1, 2024

You're welcome.

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

Sign in to reply to this post.