Sub Maroon()
Dim ws As Worksheet, ws2 As Worksheet
Dim rng As Range
Dim Dercol As Long, Derlig As Long, Col As Long
Set ws = Worksheets("BASE")
Set ws2 = Worksheets("RECAP")
With ws
Derlig = .Range("A" & Rows.Count).End(xlUp).Row
Dercol = .Cells(1, Cells.Columns.Count).End(xlToLeft).Column
Set rng = .Cells(2, 1).Resize(Derlig - 1, Dercol)
End With
For Col = 2 To Dercol
ws2.Cells(3, Col + 1).Value = WorksheetFunction.SumIfs(rng.colums(Col), rng.Columns(1), "AN") _
+ WorksheetFunction.SumIfs(rng.colums(Col), rng.Columns(1), "AN_M") _
+ WorksheetFunction.SumIfs(rng.colums(Col), rng.Columns(1), "AN_P")
Next Col
End Sub