Sumproduct with multiple text criteria giving an #N/A error (Weighted Average Formula)

marklemachin

New Member
Joined
Mar 23, 2018
Messages
9
qtygpsalespersonsku
14%andrew#N/A
14%andrew2
23%andrew2
32%kyle2
44%kyle#N/A

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>


I want the weighted average of column 2 in regards to column 1 when column 3 equals andrew and when column 4 does not equal #N/A.

My formula is this: =SUMPRODUCT(--(C2:C6="andrew"),--(D2:D6<>"#N/A"),B2:B6,A2:A6)/SUMPRODUCT(--(C2:C6="andrew"),--(D2:D6<>"#N/A"),A2:A6)

No matter how I twist the formula I get an #N/A error
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Maybe...

=SUMPRODUCT(--(C2:C6="andrew"),--ISNUMBER(D2:D6),B2:B6,A2:A6)/SUMPRODUCT(--(C2:C6="andrew"),--ISNUMBER(D2:D6),A2:A6)

M.
 
Upvote 0
=SUMPRODUCT(--(vlookup!A:A="Andrew Cicisly"),--ISNUMBER(vlookup!C:C),Sales!F:F,Sales!D:D)/SUMPRODUCT(--(vlookup!A:A="Andrew Cicisly"),--ISNUMBER(vlookup!C:C),Sales!D:D)

Where column F is Gross Profit and column D is Qty. The only difference between the example equation that didn't give me an error and this actual equation is that I'm using the whole column instead of just a range. P.S...the columns on both tabs are same length.
 
Upvote 0
The reason you are getting divided by zero error is that SUMPRODUCT(--(vlookup!A:A="Andrew Cicisly"),--ISNUMBER(vlookup!C:C),Sales!D:D) equals zero. That said what are you doing there? Why are you using two different sheets? Ive used countless sumproduct formulas and have never used one that references different sheets in that manner. Are you saying your data is in different sheets but that the rows are connected somehow?
 
Upvote 0
Yes, its a very large workbook with many different vlookups that tell me whether or not a sale of a sku is in a specific sku category. I was able to find the sum of averages for Gross Profit but my boss wants a weighted average instead. This formula below worked for the sum of averages but now I'm having trouble with weighted average.

=IFERROR(AVERAGEIFS(Sales!F:F,vlookup!$A:$A,"Andrew Cicisly",vlookup!$C:$C,"<>"&"#N/A",Sales!F:F,"<>0"),0)
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,677
Members
449,092
Latest member
tayo4dgacorbanget

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?

Disable AdBlock

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
Back
Top