View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default SUMIF vs SUMPRODUCT

Try it this way:

=SUM(IF(RIGHT(D2:D456,5)="37057",Q2:Q456))

This is an array formula, which means that once you have typed it in (or
subsequently edit it) you must use Ctrl-Shift-Enter (CSE) to commit it,
rather than the usual <Enter. If you do this correctly, then Excel will
wrap curly braces { } around the formula when viewed in the formula bar -
you must not type these yourself.

Note the similarity with the SUMPRODUCT formula, but with that you do not
need to use CSE.

Hope this helps.

Pete

"Dave F" wrote in message
...
The following returns 223,559.29:

=SUMPRODUCT(--(RIGHT(D2:D456,5)="37057"),--(Q2:Q456))

The following returns 0:

=SUMIF(D2:D456,--(RIGHT(D2:D456,5)="37057"),Q2:Q456)

I would expect these two formulas to return the same value. What am I
doing wrong with the SUMIF formula (the value returned by SUMPRODUCT
appears to be correct.)

Thanks.

Dave