NancyQ
NancyQ

Reputation: 3

Shortening simple IF formula in Xcel

What is a simple way to expand the following formula so it applies to rows 2-20 of my spreadsheet:

=SUM(IF(B2=1,M2),IF(B3=1,M3),IF(B4=1,M4))

Upvotes: 0

Views: 66

Answers (3)

Slai
Slai

Reputation: 22886

= SUMPRODUCT( ( B2:B20 = 1 ) * M2:M20 )

or

= SUMIF(B2:B20, 1, M2:M20)

Upvotes: 1

Karl Kristjansson
Karl Kristjansson

Reputation: 328

This formula will add up the rows in column M, if the same row column B = 1.

SUMIF(B2:B20,1,M2:M20)

Upvotes: 0

Variatus
Variatus

Reputation: 14383

=INDEX($M$2:$M$20,MATCH(1,$B$2:$B$20,0))

Upvotes: 0

Related Questions