# Sum two variables while retaining the total for the next new number

✭✭
edited 03/08/23

I have two variables in my spreadsheet 'Number of Hours per week' and Total Number of Hours per Study'. I want the 'Number of Hours per Week' to add to the 'Total Number of Hours per Study' column per row. In this case the 'Total Number of Hours per Study' [10] would automatically change to 14 (Shown in Test Column). The next row will be 24 and so on. When a new number for the next week is added to 'Number of Hours per week' then that new number would add to the 'Total Number of Hours per Study' In this example 'Number of Hours per Week' [some new number?] + Total Number of Hours per Study' [14] basically I will have a running 'Total Number of Hours per Study' column. Not sure how to retain the value so it can be used in the function. I'm hoping to make it simple to add this level of automation into the table so my team doesn't have to manually add up these two columns. Sounds simple but it has me stumped! Hope I am making sense as I think I am making this more complicated than it is.😄

Regards,

Jeff

• ✭✭✭✭✭✭

Have you tried adding the two columns together?

=[Number of Hours per Week]@row + [Total Number of Hours per Study]@row

Or am I misunderstanding what you are trying to do?

• ✭✭

Hello Paul,

Yeah I can do that. But I don't know how to hold that new value and increase the ‘Number of Hours per Week’.

In my example above 4 + 10 = 14, then the next time they need to input their hours (Let's say 2 Hours per week) it would be 2 + 14 = 16, then with the next iteration (Let's say 4 Hours per week) it would be 4 + 16 = 20. I am needing to hold the new ‘Total Number of Hours per Study’ for the next 'Number of Hours per week' input. Thanks so much for your input.

Regards,

Jeff

• ✭✭✭✭✭✭

I'm not sure I follow. Is the screenshot in the original post not correct? It looks like there you are looking to just add on each row in the [Test Column], but now it sounds more like you want a rolling total?

• ✭✭

Hello Paul!

Apologies in the delay. I have been on vacation. I created the 'Test Column' so you can see what I am looking for. You are correct that I am looking for a rolling total by row. Apologies for the confusion.

Regards,

Jeff

• ✭✭✭✭✭✭

So [Test Column] should actually read

14

38

52

Is that correct?

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!