How to calculate weighted average with multiple criteria

dahl07

New Member
Joined
Apr 25, 2012
Messages
11
Hello,

I have figured out how to calculate the total weighted average in my data sheet with this formula:

=SUMPRODUCT((DATA!AA285:AA20000)*(DATA!N285:N20000))/(SUM(DATA!N285:N20000))

Now I need to figure out, how I can calculate this with two criterias;
1) DATA!AH285:AH20000=Distrikter!C3
2) DATA!H285:H20000=Distrikter!D2

I am not sure what to do from here - maybe IF or another SUMPRODUCT.

Thank you for considering my request, I have used several hours on this now...
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Use something like:

=SUMPRODUCT((DATA!AH285:AH20000=Distrikter!C3)*(DATA!H285:H20000Distrikter!D2)*(DATA!N285:N20000))/(SUM(DATA!N285:N20000))
 
Upvote 0
Cell returns #N/A. I have tried the formula below as well, but it still returns #N/A:

=SUMPRODUCT(--(DATA!$AH$285:$AH$34664=Distrikter!F3);DATA!$N$285:$N$34664;DATA!$AA$285:$AA$34664)/SUMIF(DATA!$AH$285:$AH$34664;Distrikter!F3;DATA!$N$285:$N$34664)
 
Upvote 0
I just noticed, that some cells in my data says #N/A - is that why? And if so, how can I exclude these in the calculation?
 
Upvote 0
Cell returns #N/A. I have tried the formula below as well, but it still returns #N/A:

=SUMPRODUCT(--(DATA!$AH$285:$AH$34664=Distrikter!F3);DATA!$N$285:$N$34664;DATA!$AA$285:$AA$34664)/SUMIF(DATA!$AH$285:$AH$34664;Distrikter!F3;DATA!$N$285:$N$34664)
i think you must go in the cell and press CTRL SHIFT ENTER;;; i think it is better to eliminate the #N/A before you use sumproduct,, using iferror(formula, 0)
 
Upvote 0
There is a lot of #N/A, and they are looked up from another sheet as well, so I am not able to eliminate them.. How does the iferror work with my formula?
 
Upvote 0
I just noticed, that some cells in my data says #N/A - is that why? And if so, how can I exclude these in the calculation?

Which range include the N/A errors?
It was suggested to get rid from error before use of the SUMPRODUCT but you do not need to confirm with CTRL+SHIFT+ENTER
 
Upvote 0
Hello,

I have figured out how to calculate the total weighted average in my data sheet with this formula:

=SUMPRODUCT((DATA!AA285:AA20000)*(DATA!N285:N20000))/(SUM(DATA!N285:N20000))

Now I need to figure out, how I can calculate this with two criterias;
1) DATA!AH285:AH20000=Distrikter!C3
2) DATA!H285:H20000=Distrikter!D2

I am not sure what to do from here - maybe IF or another SUMPRODUCT.

Thank you for considering my request, I have used several hours on this now...

Try...
Rich (BB code):
=SUMPRODUCT(
    --(DATA!AH285:AH20000=Distrikter!C3),
    --(DATA!H285:H20000=Distrikter!D2),
    DATA!AA285:AA20000,
    DATA!N285:N20000)/
  SUMPRODUCT(
    --(DATA!AH285:AH20000=Distrikter!C3),
    --(DATA!H285:H20000=Distrikter!D2),
    DATA!N285:N20000)

If you re on Excel 2007 or later:
Rich (BB code):
=SUMPRODUCT(
    --(DATA!AH285:AH20000=Distrikter!C3),
    --(DATA!H285:H20000=Distrikter!D2),
    DATA!AA285:AA20000,
    DATA!N285:N20000)/
  SUMIFS(
    DATA!N285:N20000
    DATA!AH285:AH20000,Distrikter!C3,
    DATA!H285:H20000,Distrikter!D2)
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,571
Members
452,652
Latest member
eduedu

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