Trying to figure sum calculation for variable values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2014 01:14 PM
I am trying to build a catalog item that is based on a spreadsheet that used the =sum calculation. I've found a few ideas out there but nothing that will work for me. We'd like it to be just for this catalog item so not a business rule. Currently I have 5 columns, 1st year — 5th year and we'd like each column to show the total at the end (a total cost of ownership). Please see screenshot. I got the fields figured out, now I just need a formula. We'd like the user to be able to see the change as they did with the spreadsheet and not have the sum just sent in the form. I will make the TCO (bottom) row read-only if I get this all figured out.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 12:26 PM
I'm adding the columns, not the rows. Also I should have added I'm not very good with scripts which is why I was asking for help... so this is confusing to me when you are saying add the rows. I need the costs for the first year, then the second year, etc. and there is a totals field at the bottom in the screenshot (Total Cost of Ownership).
If you see how I made the fields it's a HUGE mess of variables. It's 13 variables to make one row. There are 10 rows, no actual columns. It just gets messy and confusing when I then have to add calculations into the mix.
I appreciate everyone's help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 12:37 PM
And that is why I was saying to name the variables based on how they display to the user. So
row_1_year_1
row_1_year_2
row_1_year_3
row_2_year_1
row_2_year_2
row_2_year_3
Then when you go thru a loop you now can predict what to add. i.e. row_1_year_1 + row_2_year_1 + ....
Does that make sense?
I attached a pic of what I am saying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 12:40 PM
Yes, that does. Thank you. I know it's me that is confused and not you! I will give that a try. I'll let you know how it goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 02:04 PM
I got all of the variables renamed. I'm having an issue with the script (again the script is my weak spot - I am new in this postion so still learning). I don't know what I might need to change to make it work for me and I'm also trying to understand the script itself. I have row_1_year_1 through row_12_year_1 - 12 being the total field. What needs to be added as you punch in the figures are all row (1-11) for year 1. Then row_1_year_2 adding to total field row_12_year_2, etc.
When I use the script I get these two errors:
JavaScript parse error at line (3) column (13) problem = identifier is a reserved word
WARNING at line 2: 'total' is already defined.
ERROR at line 3: Expected ';' and instead saw 'y'.
----------------------
Also am I adding this as OnCellEdit ?
Thanks again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 04:43 PM
Please post your script. Also this needs to be an onChange script for all of the boxes that the user will type in.