VBA check to see if 2 cells are the same, if they are then SUM 2 other cells

I am trying to SUM 2 (or more) values together in VBA, but to find out which cells to SUM i need to check if cells in another column are the same.


  • VVVAAA - 14 - 14 -
  • VVVAAA - 13 - 27 -
  • VVVBBB - 10 - 10 -
  • VVVBBB - 12 - 22 -

Basically if cells in column A is the same then SUM all values the rows in column B that match and put the answer in column C

1 answer

  • answered 2018-10-16 21:42 Scott Craner

    No need for VBA use SUMIF with a dynamic Range:


    Pay attention to the fact that the first cell in the ranges are absolute while the second is relative allowing it to move down as the formula is dragged down.

    enter image description here