Robby
Robby

Reputation: 827

VBA - SumIf with multiple criteria

I'm having trouble figuring out how to set multiple criteria for a SumIf statement in VBA. This is what I'm using right now with only one criterion to set the value of a variable called Count_1.

Count_1 = Application.SumIf(Range("K84:K" & LastRow), "B*", Range("G84:G" & LastRow))

I need to add another criterion. In addition to the value in column K needing to begin with "B", the value in column L also needs to be 80.

I know this can be done using SumIfs in an Excel formula, but I need it to be in VBA.

Upvotes: 1

Views: 15490

Answers (1)

Pspl
Pspl

Reputation: 1474

Use

Application.Sumifs(SumRange, CriteriaRange1, Criteria1, CriteriaRange2, Criteria2,...)

Upvotes: 5

Related Questions