Home > Software engineering >  google spreadsheets: IF and AND (cell ranges)
google spreadsheets: IF and AND (cell ranges)

Time:11-26

I want to express:

IF a1:a5 contains the value "George" AND b1:b5 contains the value "Nick" then SUM the values of c1:c5. It seems I can't find a way to do it.

Most recent working attempt: =IF(AND(a1="George";b1="Nick"); SUM(C1:C5); "Your condition was not met!")

The problem is when I try ranges (i.e.a1:a5="George")

CodePudding user response:

try:

=SUMPRODUCT(FILTER(C1:C5; A1:A5="George"; B1:B5="Nick"))

or just:

=SUM(FILTER(C1:C5; A1:A5="George"; B1:B5="Nick"))

CodePudding user response:

=sumproduct(A1:A5="George"; B1:B5="Nick"; C1:C5 )
  • Related