If a column has a value add to another column?
Solved/Closed
Related:
- If a column has a value add to another column?
- 2007 microsoft office add-in microsoft save as pdf or xps - Download - Other
- How to add songs to sound picker - Guide
- How to add @ in laptop - Guide
- Add messenger to home screen - Guide
- How to add a tick in word - Guide
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 30, 2018 at 11:23 AM
Aug 30, 2018 at 11:23 AM
Hi The4Elements,
So for example column AA = empty and AB1 = -100
Now for each value of 100 you enter anywhere in column AA, you want to add 1 to AB1?
The formula to use would be in AB1:
=-100+COUNTIF(A:A,100)
Not sure though if I understand you correctly.
Best regards,
Trowa
So for example column AA = empty and AB1 = -100
Now for each value of 100 you enter anywhere in column AA, you want to add 1 to AB1?
The formula to use would be in AB1:
=-100+COUNTIF(A:A,100)
Not sure though if I understand you correctly.
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 30, 2018 at 11:47 AM
Aug 30, 2018 at 11:47 AM
Hi The4Elements,
For that we have to use VBA.
Right-click your sheets tab and select 'View code'.
Paste the code below in the big white field:
You can close the VBA window now and start testing the code.
Does it perform as desired?
Best regards,
Trowa
For that we have to use VBA.
Right-click your sheets tab and select 'View code'.
Paste the code below in the big white field:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Columns("AA"), Target) Is Nothing Then If Target.Value = 100 Then Target.Offset(0, 1) = Target.Offset(0, 1) + 1 Target.Value = 0 End If End If If Not Intersect(Columns("AB"), Target) Is Nothing Then If Target.Value = 100 Then Target.Offset(0, 1) = Target.Offset(0, 1) + 1 Target.Value = 0 End If End If End Sub
You can close the VBA window now and start testing the code.
Does it perform as desired?
Best regards,
Trowa
Aug 30, 2018 at 11:38 AM