# SUMPRODUCT to get an average

#### Geoff Taylor

##### Active Member
Hi
This formula works fine...
=SUMPRODUCT(--(Data!\$N\$6:\$N\$33805=Sheet1!\$A13),--(Data!\$J\$6:\$J\$33805=Sheet1!\$B\$8),--(Data!\$M\$6:\$M\$33805=Sheet1!\$B\$7),--(Data!\$L\$6:\$L\$33805))

It gives me a total value for all rows that meet the 3 criteria elements. Lovely. Now I would like to find the average of these values and I can't seem to get the syntax correct. Help please.

Thanks

### Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try:
=SUMPRODUCT(--(Data!\$N\$6:\$N\$33805=Sheet1!\$A13),--(Data!\$J\$6:\$J\$33805=Sheet1!\$B\$8),--(Data!\$M\$6:\$M\$33805=Sheet1!\$B\$7),--(Data!\$L\$6:\$L\$33805))/SUMPRODUCT(--(Data!\$N\$6:\$N\$33805=Sheet1!\$A13),--(Data!\$J\$6:\$J\$33805=Sheet1!\$B\$8),--(Data!\$M\$6:\$M\$33805=Sheet1!\$B\$7))

Actually, you should be able to leave out the last double negative from your original formula: The double negative is used to turn TRUEs and FALSEs to 1s and 0s. The last column should return numeric values anyway or the formula wouldn't make any sense.

Last edited:
You could use this array formula

=AVERAGE(IF(Data!\$N\$6:\$N\$33805=Sheet1!\$A13,IF(Data!\$J\$6:\$J\$33805=Sheet1!\$B\$8,IF(Data!\$M\$6:\$M\$33805=Sheet1!\$B\$7, Data!\$L\$6:\$L\$33805))))

confirmed with CTRL+SHIFT+ENTER

[or in Excel 2007 or later you could use AVERAGEIFS function]

=SUMPRODUCT(--(Data!\$N\$6:\$N\$33805=Sheet1!\$A13),--(Data!\$J\$6:\$J\$33805=Sheet1!\$B\$8),--(Data!\$M\$6:\$M\$33805=Sheet1!\$B\$7),--(Data!\$L\$6:\$L\$33805))/ countif same criteria

Thank you both for the quick responses.

Replies
9
Views
155
Replies
4
Views
138
Replies
3
Views
148
Replies
9
Views
271
Replies
5
Views
245

1,203,610
Messages
6,056,291
Members
444,855
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back