I have a spreadsheet to keep track of payments on group trips and would like to be able to keep everything within that spreadsheet. I would like the ability to be able to delete from the sum that someone owes, and then have that cell autodelete the contents. For instance, I specifically have I4 with the sum of one person's total, and want to be able to input the money they already paid on cell J4, and then have J4's contents autodelete so a user can continue to input the amount they pay onto that cell without having to manually add it every time.
I did find this code on another thread, but I will be frank, my experience is close to none and even with trying to do further research on how onEdit(e) functions work, I was unable to figure out how to put this to use in the specific cells that I need.
function onEdit(e) { var {range, value} = e; var r = range.offset(0, 1); r.setValue(Number(value) + Number(r.getValue())); // I think Number(r.getValue()) can be modified to r.getValue() range.clearContent();}- When I do run the code I've run into "TypeError: Cannot destructure property 'range' of 'e' as it is undefined". I've looked around and seen some people have similar issues, and have a vague understanding of what is wrong, but I cannot find a way to actually debug it. I've added an installed trigger, but that has not yielded any results.
I know that I'm asking for a lot of hand holding, and the answer to this may just be looking at me right in the face, but I cannot figure it out for the life of me. I've tried troubleshooting it for the past two days with whatever free time that I have, but honestly, the only other option I have (other than abandoning it all together) is to study this from the ground up which will take me a long time. I appreciate any help, as I know that I'm asking for a lot. If possible, I would like to also do the same thing in the same sheet for another running total in cells I11 and J11 for the same things respectively, and would wonder if there is a way to implement that into the code, or if I would need to do them in a separate sheet or something else altogether.