Newbie here and I am uncertain how to go about setting up this macro, so my apologies in advance. For each similar value in Column AA, I would like to sum the values in Column Y and then subtract the values in Column X and put the calculated value into Column Z. I have attached an example of what I am looking for. All I've got so far is a recorded macro, so I'm open towards going in a different direction. Any help would be greatly appreaciated.
Sub Sum
Selection.FormulaR1C1 = "=SUM(RC[-1])"
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z7").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-4]C[-1]:RC[-1])-SUM(R[-4]C[-2]:RC[-2])"
Range("Z18").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-10]C[-1]:RC[-1])-SUM(R[-10]C[-2]:RC[-2])"
Range("Z19").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z23").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C[-1]:RC[-1])-SUM(R[-3]C[-2]:RC[-2])"
Range("Z24").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z24").Select
Selection.Copy
Application.CutCopyMode = False
Range("Z25").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z26").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z27").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z28").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
Range("Z29").Select
End Sub
Thanks in advance,
Ray
Bookmarks