Constantly changing the value of the cell...and finding the sum of the difference in the change

sofas

Active Member
Joined
Sep 11, 2022
Messages
468
Office Version
  1. 2019
Platform
  1. Windows
I hope to find someone to help me complete one of the projects, and the idea is as follows

Suppose you have a cell and it contains the number 10. Of course, let us assume that this value is constantly changing every minute.

Let's assume that the changes that occurred during the minute were as follows..

10 then became 13, then 9, then 16, then 7

Here we want to calculate the current value from the previous value with each change that occurred, and the result will be as follows

Of course, positive values occur when the current value is higher than the previous value, and the opposite of that are negative values

The first change was from 10 to 13................. So the difference is 3 points positive

The second change was from 13 to 9, so the difference is 4 points in the negative

The third change is from 9 to 16 ................. So the difference is 7 points positively

The fourth change is from 16 to 7 ................... so the difference is 9 points in the negative

So, the total sum of the positive value is 10

The grand total of the negative value is 13

Of course, every change that occurs, whether positive or negative, is added to the total positive of positive values or negative of negative values.


If there is anything incomprehensible, I can explain it again
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Now I get the sum of the negative and positive in the cell (G2 ) How can I make the sum of the negative in an independent cell and the sum of the positive in another cell

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$E$2" Then
        Call Update_TsQ
    End If
End Sub

Sub Update_TsQ()

Dim QiS As Long
Dim TsQ As Long

QiS = Range("E2").Value
TsQ = Range("G2").Value

TsQ = TsQ + QiS
Range("G2").Value = TsQ

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top