How do I create a table that will add numbers together for a total at the end of a column?

  • kimb642
    Asked on August 11, 2016 at 9:35 AM

    I am working on an application form where the user will need to submit a budget with an item, item description and an amount. 

    There is an unlimited number of items, but all of the subtotal amounts will need to be added together for a total. 

    I envision this as being 3 columns: 1st Column - Item, 2nd Column - Item Description, 3rd Column - Total. There will be an unlimited amount of rows. 

    At the bottom of the budget portion, the totals will need to be added into a grand total. 

    What is the best way to set this up using Jotform?

    Thank you!

  • Charlie
    Replied on August 11, 2016 at 10:57 AM

    If you are aiming for unlimited rows, then I believe it is NOT possible. 

    You can perform different calculations on your form using the form calculation widget or by using the conditional logic feature. You can check the following guides on how to do this:

    https://www.jotform.com/help/259-How-to-Perform-Calculation-in-the-Form 

    https://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Calculation-into-a-Field-Using-Conditional-Logic 

    But those methods involved fix number of items. So you will need to setup a maximum number of items or rows that can be part of the calculation. 

     

    If you are just aiming to have an unlimited number of rows WITHOUT calculation, then you can use any of the following widgets below:

    Configurable List widget 

    Infinite List widget 

     

    Our most advance widget for that is the Configurable List widget, here's a guide to learn more about it: 

    I hope that helps.

  • kimb642
    Replied on August 16, 2016 at 11:53 AM

    I've set up a matrix to attempt to use conditional logic.

    I thought I'd set up the logic to where if any cell in the "total cost" column was filled, the matrix would add up all the cells in that column and the total would appear in the calculation widget.

    When I tested this, nothing happened.

    Any suggestions? This is quite confusing. 

  • Charlie
    Replied on August 16, 2016 at 12:12 PM

    I checked your form and I see that your condition wants to total the matrix cells to a field titled "Calculation", however, there's actually two fields named "Calculation" in your form, one is on page 2 and the other is one page 4. 

    Your condition is actually pointing to page 2. I presume this is the problem?

    How do I create a table that will add numbers together for a total at the end of a column? Image 1 Screenshot 50

     

    If you want to total the cells and output it on the "Calculation" field in your page 4, then change the "Summary" option in your condition and point it to the "64. Calculation".

    How do I create a table that will add numbers together for a total at the end of a column? Image 2 Screenshot 61

     

    Another problem is your calculation, you have an extra "+" in your formula which causes a problem I believe. Remove the extra "+" at the end and save the changes:

    How do I create a table that will add numbers together for a total at the end of a column? Image 3 Screenshot 72

     

    This is how it looks like in my cloned form after those changes:

    How do I create a table that will add numbers together for a total at the end of a column? Image 4 Screenshot 83

    You can see on my screencast above that each total cost on each row is now being added in the calculation field. You can check my cloned form here: https://form.jotform.com/62284321423953?jumpToPage=4 

    I hope that helps.

  • kimb642
    Replied on August 16, 2016 at 12:28 PM

    I've made those changes and that helped, BUT It seems to be adding all of the fields except for the total cost for item 1. Any suggestions?

  • Charlie
    Replied on August 16, 2016 at 12:42 PM

    May I know if it reflects on my cloned form? 

    Mine shows that the total cost in "Item 1" is still being added correctly. Could you please check my form?

    Below is a screencast of the problem, you can see below I input "1" on item 1 and "1" on item 15. You can see that it add up to "2" which is correct. I then inputted "1" on all of the items so that we can see if it will all add up. You can see that my total calculation is "15" which is correct because we have 15 items with "1" on each total cost:

    How do I create a table that will add numbers together for a total at the end of a column? Image 1 Screenshot 20

     

    If you are still having problems, please do provide us more information and steps on how to replicate the problem.

  • kimb642
    Replied on August 16, 2016 at 1:20 PM

    Yes, it is working correctly on yours. However, when I preview my form it does not add in the total cost for item 1. All of the other items are adding correctly.

  • Charlie
    Replied on August 16, 2016 at 2:15 PM

    This is because you did not add the item 1 in your conditional logic's calculation. You can see here that there's a "+" at the start of the calculation, which is incorrect. If you also count the number of items on that formula, you only get "13", which is also incorrect. Please do make sure that all of the items you need to have in the formula is added correctly. Please do avoid unnecessary characters or excess math function which will make the calculation invalid:

    How do I create a table that will add numbers together for a total at the end of a column? Image 1 Screenshot 20

     

    I went ahead and updated your form directly, please try it again.