I have a formula in column AV that is summing some values in a table and another formula in AW that is summing some different values in the same table. I cannot sum Columns AV and AW together in the same cell as it creates a circular reference because I am using a sumif as part of the equation and they are in the same array. I want to create a macro that will add the value in column AW to the corresponding cell in AV. The columns go from row 14 to row 74. For example, if the calculation changes in cell AW21 then I want it to add the value of AW21 to AV21 at the end of the formula. I need to keep the formula in column AV and can only have one result at a time to the end of the formula in column AV. So when there is a change the old result needs removed. Here is the macro I have so far. It will add the value to the end of the formula but won’t remove the old. Also, it won’t add a value when the calculation in AW changes. I must hand enter a number for it to work. I have tried a bunch of different things but below is what I have currently. Any suggestions are appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("AW14:AW74")) Is Nothing Then
If IsNumeric(Target.Value) Then
With Target.Worksheet.Range(Target.Address)
.Offset(0, -1).Formula = .Offset(0, -1).Formula & "+" & Target.Value
End With
End If
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("AW14:AW74")) Is Nothing Then
If IsNumeric(Target.Value) Then
With Target.Worksheet.Range(Target.Address)
.Offset(0, -1).Formula = .Offset(0, -1).Formula & "+" & Target.Value
End With
End If
End If
End Sub