I can't tell exactly what you're doing, but I added extra checks just in case
Capture.JPG
Option Explicit
Option Compare Text
Sub GetTotal()
Dim iRow As Long
Dim Total As Double
Dim TheYear As String, TheMonth As String, Theitem As String
Dim r As Range
With ActiveSheet
Set r = .Cells(1, 1)
Set r = Range(r, r.End(xlDown).Offset(0, 3))
' get your values from the linked cells.
TheYear = Trim(.Range("E1").Value)
TheMonth = Trim(.Range("F1").Value)
Theitem = Trim(.Range("G1").Value)
For iRow = 2 To r.Rows.Count
If .Cells(iRow, 1).Value <> TheYear And TheYear <> "all" Then GoTo NextLine
If .Cells(iRow, 2).Value <> TheMonth And TheMonth <> "all" Then GoTo NextLine
If .Cells(iRow, 3).Value <> Theitem And Theitem <> "all" Then GoTo NextLine
Total = Total + .Cells(iRow, 4).Value
NextLine:
Next iRow
.Cells(1, 1).End(xlDown).Offset(1, 3).Value = Total
End With
End Sub