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

marklemachin

New Member
Joined
Mar 23, 2018
Messages
9
[TABLE="width: 165"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]qty[/TD]
[TD]gp[/TD]
[TD]salesperson[/TD]
[TD]sku[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]3%[/TD]
[TD]andrew[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]2%[/TD]
[TD]kyle[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]4%[/TD]
[TD]kyle[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
</tbody>[/TABLE]


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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
So now I'm back to my original problem... so for this example with the sku colum not having any numbers. I apologize for giving the wrong data before.

[TABLE="width: 172"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]qty[/TD]
[TD]gp[/TD]
[TD]salesperson[/TD]
[TD]sku[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD]crank[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]3%[/TD]
[TD]andrew[/TD]
[TD]smpm[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]2%[/TD]
[TD]kyle[/TD]
[TD]hat3[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]4%[/TD]
[TD]kyle[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
</tbody>[/TABLE]

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)
 
Upvote 0
So now I'm back to my original problem... so for this example with the sku colum not having any numbers. I apologize for giving the wrong data before.

[TABLE="width: 172"]
<tbody>[TR]
[TD]qty[/TD]
[TD]gp[/TD]
[TD]salesperson[/TD]
[TD]sku[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]4%[/TD]
[TD]andrew[/TD]
[TD]crank[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]3%[/TD]
[TD]andrew[/TD]
[TD]smpm[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]2%[/TD]
[TD]kyle[/TD]
[TD]hat3[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]4%[/TD]
[TD]kyle[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
</tbody>[/TABLE]

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)

Try this:

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

Markmzz
 
Upvote 0

Forum statistics

Threads
1,225,777
Messages
6,186,982
Members
453,393
Latest member
djangoframe

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