Level 1

0% to

Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

## Adding a column of numbers, doing simple calculations

Level 2

Could someone please tell me how to add a simple column of numbers. I need to have a subtotal, add a fee, add tax, and get a Total.

I really hope I can do this easily.

Thanks for any help.

0 Replies

Level 10

Hi,

FormCalc works well for this sort of calculation.

If all of the rows have the same name 'Row1', so that in the hierarchy you would see all of the instances of the row as: 'Row1[0]', 'Row1[1]', 'Row1[2]',... 'Row1[n]'.  Lets say the objects in the column you want to add are called 'amount'. Then this FormCalc in the calculate event should work:

`\$ = Sum(Row1[*].amount[*])`

This will also work if the row is repeatable.

If the rows are named differently, then you may need to manually add them together. Again this is FormCalc:

`\$ = Row1.amount + Row2.amount + Row3.amount`

You can use JavaScript or FormCalc for this but if we stick with FormCalc:

`\$ = subTotal * 0.05 //in the calculate event of the feeAmount object (5 percent fee)`

`\$ = subTotal * 0.21 //in the calculate event of the taxAmount object (21 percent tax)`

`\$ = subTotal + feeAmount + taxAmount //in the calculate event of the total object`

Hope that helps,

Niall

Level 2

Thank you very, very much! I've never used Formcalc but I'll dive into this and if I have any problems, I'll post again.