[Solved] Running total in accumulator

Discuss the spreadsheet application
Post Reply
Grandapa Jim
Posts: 4
Joined: Sun Mar 24, 2024 9:14 pm
Location: Florence AZ

[Solved] Running total in accumulator

Post by Grandapa Jim »

I was looking for group "Calc for the Stupid" and this group seemed to be close.

I have a Column of cells that I update daily. I then =SUM(A1:A10) in cell A11.

What I want to do is add A11 to the current value in A12. I tried using the CURRENT() function, but it seems to double the value.

Is there a way to do this.
Last edited by MrProgrammer on Mon Apr 15, 2024 8:42 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved] Solutions provided and no further questions from Grandapa Jim-- MrProgrammer, forum moderator
Jim Openoffice 4.1.15 Win 11
User avatar
RoryOF
Moderator
Posts: 34621
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Running Total

Post by RoryOF »

In A13 enter =A11+A12

If you wish A12 to be increased by the value in A11, this is equivalent to A12 equaling A11+A12 - a circular reference, which in spreadsheets is not allowed
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Running Total

Post by Villeroy »

Attachments
111410.ods
(17.16 KiB) Downloaded 20 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Grandapa Jim
Posts: 4
Joined: Sun Mar 24, 2024 9:14 pm
Location: Florence AZ

Re: Running Total

Post by Grandapa Jim »

Why is this so difficult? How does one set up an accumulator. The CURRENT() function looks like it should work for what I am trying to do. I tried setting A12to =CURRENT() + A11 But that seems to double the value.
Jim Openoffice 4.1.15 Win 11
User avatar
Zizi64
Volunteer
Posts: 11365
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Running Total

Post by Zizi64 »

What is so difficult?

A very simple rule: You can not store a single constant number AND a Formula in same time in a Cell.

But you can store the new values (as constant) in the Formulas:
For A12: =A11+23.45
For A13: =A12+33.45

Of course the Cell will not display the new entered constant value, but it will show the new result.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
MrProgrammer
Moderator
Posts: 4912
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Running Total

Post by MrProgrammer »

Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Running Total

Post by Lupp »

Grandapa Jim wrote: Sat Mar 30, 2024 5:49 am Why is this so difficult? How does one set up an accumulator.
A spreadsheet is no pocket calculator which has an accumulating register. Spreadsheets also have no variables usable as accumulators like any general-purpose program.

If you want to use a spreadsheet cell as an accumulator you basically need to equip it with a procedural program in the background.

To simulate accumulation using spreadsheet formulas as they are (low-level functional programming), you need to write every single input to a cell in a way as @Villeroy already exemplified.

A variant is shown in the attached sheet.
accumulatringExample.ods
(19.04 KiB) Downloaded 18 times
===Editing===
Now there is also an example with accumulating cells based on a sheet event handler for onContentChanged.
accumulatingExampleWithBackgroundMacro.ods
(14.41 KiB) Downloaded 17 times
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply