SUMPRODUCT won't work on a row

P

PFB

The following formula works on a column range (A1:A40), but not on a row
range (A10:U10). What have I missd?

=SUMPRODUCT(--(A10:U10={"P","B","S","V","H","PBSVH"}))
 
B

Bernie Deitrick

You need to transpose your array:

=SUMPRODUCT(--(A10:U10={"P";"B";"S";"V";"H";"PBSVH"}))

Note the semicolons instead of commas....

HTH,
Bernie
MS Excel MVP
 
T

T. Valko

You have to make the array constant a vertical array. Using commas makes it
a horizontal array. Replace the commas with semicolons:

=SUMPRODUCT(--(A10:U10={"P";"B";"S";"V";"H";"PBSVH"}))
 
P

PFB

Thanks! Where can I find info on why a horizontal (row) data set must be
tested against a vertical array? (Yes, I'm new to this.)
 
B

Bob Phillips

I don't believe that it mentions transposing an array constant, but it does
mention transposing a range array using TRANSPOSE, which is the same effect,
i.e.

=SUMPRODUCT(--(A10:U10=TRANSPOSE({"P","B","S","V","H","PBSVH"})))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top