D
D
Denis Davydenko2018-08-22 20:26:50
Spreadsheets
Denis Davydenko, 2018-08-22 20:26:50

How to make a daily increasing cell?

Hello.
There are 2 cells.
A1 and A2.
A1 contains daily data. A2 contains the total amount of data. At the moment A1=5, A2=17.
How can I make it so that the value from A1 would be added to A2 daily after the new value was entered?
Those. if today A1=5, then A2=22. Tomorrow A1=6, then A2=28, etc.
Or if it's simpler, how to make it so that the total sum of the values ​​\u200b\u200bentered into A1 would be considered in the cell.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bcoon, 2018-08-22
@GooseTheDestroyer

Need a macro. The code is like this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
      With Target
         If .Address(False, False) = "A1" Then
            If IsNumeric(.Value) Then
               Application.EnableEvents = False
               Range("A2").Value = Range("A2").Value + .Value
               Application.EnableEvents = True
            End If
         End If
      End With
End Sub

A1 - cell for daily value, A2 - accumulative. If necessary, change the code to your own.
Place the code in the sheet module (right click on the label - Source code)
Well, save the file as a file with macro support (.xlsm)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question