Formula ? SUM of 2 cells

cripopes

New Member
Joined
Apr 4, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hello folks,

First of all please excuse my lack of excel knowledge, the following question might seem a bit nooby for you but I'm at my first steps here.

What I'm trying to do is SUM of cell 1 into cell 2 - cell 1 will be constantly changing every day and that input amount to be added into cell 2.

Capture.PNG


For example, I want cell B3 to be added to D3, which will be 278. So basically the input number of B3 to be added into D3. The original value of D3 will not be blank, it will be an input number.
 
If I correct understand when you modify cell C3 then if C3 = 4 & D3 = 229
D3=D3-C3 & D3= 225
Is this correct?
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newVal As Long, oldVal As Long
    If Target.Column = 2 Then
        'new val
        newVal = Target.Value
        Application.EnableEvents = False
        Application.Undo
         oldVal = Range("D" & Target.Row).Value
        Range("D" & Target.Row).Value = oldVal + newVal
        Target.Value = newVal
        Application.EnableEvents = True
    End If
    If Target.Column = 3 Then
        'new val
        newVal = Target.Value
        Application.EnableEvents = False
        Application.Undo
         oldVal = Range("D" & Target.Row).Value
        Range("D" & Target.Row).Value = oldVal - newVal
        Target.Value = newVal
        Application.EnableEvents = True
    End If
End Sub

This seems to work. Thanks a million, sir.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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