0
votes

I have two worksheets in Excel and I'm trying to control 2 conditions (in two different Ranges, in the same worksheet) in the second worksheet, but the vba Code is for the first worksheet. How can I realise that with the "SumIf"-Function

the Problem is the following:

SumIf(worksheet1.Range("A:A"),condition1,worksheet1.Range("N:N"))

SumIf(worksheet1.Range("H:H"),condition2,worksheet1.Range("N:N"))

The sum "Range("N:N")" needs to be done only once under conditons1 and condition2

How can I make it with only one "SumIf" ?

Thank you for your help

1

1 Answers

0
votes

Use SumIfs():

SumIfs(worksheet1.Range("N:N"),worksheet1.Range("A:A"),condition1,worksheet1.Range("H:H"),condition2)