Weighted Average with different criterias

msalas0308

New Member
Joined
Sep 30, 2020
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am trying to find the weighted average of 2 or more cells with different words. I can't seem to find the correct formula. I want to find the weighted average of everything with the word MA in it, in the Work Center column. I can't seem to get the correct formula.


Work CenterSnapshotTotal Capacity
RVR100MA31.0400.0
RVR101MA102.080.0
RVR102MA48.080.0
RVR103MA60.080.0
RVR104MA64.080.0
RVR108MA90.680.0
RVR120MA95.080.0
RVR160MM134.5240.0
RVR198MA17.0240.0
RVR199MA0.040.0
RVR200MS5.0800.0
RVR201MS92.580.0
RVR202MS92.380.0
RVR203MS64.080.0
RVR204MS71.080.0
RVR205MS78.080.0
RVR206MS0.080.0
RVR209MS0.080.0
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hello there!

I may have found a way to accomplish this. Let me know if this is what you are looking for.

I created another column (D) and labelled it as Weighted Average. In the cell D2, I used the formula

Excel Formula:
=IFERROR(IF(SEARCH("MA",A2:A2),AVERAGE(B2:C2),""),"")

It seems to calculate the correct average. It will also display a blank cell for any criteria that does not contain MA in column A.

Apologies if this is difficult to understand. I made an excel sheet to test this out, but I cannot figure out how to safely post it here. I tried doing that before, and the mods got mad at me.


Capture.PNG
 
Upvote 0
Hi & welcome to MrExcel.
It's an add-in that enables members to post data to the board, like
+Fluff New.xlsm
ABCD
1Work CenterSnapshotTotal Capacity
2RVR100MA314005916.444
3RVR101MA10280
4RVR102MA4880
5RVR103MA6080
6RVR104MA6480
7RVR108MA90.680
8RVR120MA9580
9RVR160MM134.5240
10RVR198MA17240
11RVR199MA040
12RVR200MS5800
13RVR201MS92.580
14RVR202MS92.380
15RVR203MS6480
16RVR204MS7180
17RVR205MS7880
18RVR206MS080
19RVR209MS080
Results
Cell Formulas
RangeFormula
D2D2=SUMPRODUCT((RIGHT(A2:A19,2)="MA")*(B2:B19*C2:C19))/SUMPRODUCT(--(RIGHT(A2:A19,2)="MA"))
 
Upvote 0
Another (slightly simpler) option would be
Excel Formula:
=SUMPRODUCT((RIGHT(A2:A19,2)="MA")*(B2:B19*C2:C19))/COUNTIFS(A2:A19,"*MA")
 
Upvote 0
What if I want to exclude certain MA's to the formula? I just want RVR101MA, RVR102MA, RVR103MA, RVR104MA and RVR120MA.
 
Upvote 0
Hello!

I have figured out how to do this. I had to update the code a bit to make it work. Let me know if this is what you were looking for!

The new code is:
Excel Formula:
=(IF(COUNT(SEARCH({"RVR101MA","RVR102MA","RVR103MA","RVR104MA","RVR120MA"},A3:A3)),AVERAGE(B3,C3),""))

Also, I have no idea what a XL2BB add-in is.



Capture2.PNG
 
Upvote 0
Also, I have no idea what a XL2BB add-in is.
Have a look here
 
Upvote 0
How about
+Fluff New.xlsm
ABCDEF
1Work CenterSnapshotTotal Capacity
2RVR100MA314005904RVR101MA
3RVR101MA10280RVR102MA
4RVR102MA4880RVR103MA
5RVR103MA6080RVR104MA
6RVR104MA6480RVR120MA
7RVR108MA90.680
8RVR120MA9580
9RVR160MM134.5240
10RVR198MA17240
11RVR199MA040
12RVR200MS5800
13RVR201MS92.580
14RVR202MS92.380
15RVR203MS6480
16RVR204MS7180
17RVR205MS7880
18RVR206MS080
19RVR209MS080
20
Results
Cell Formulas
RangeFormula
D2D2=SUMPRODUCT((ISNUMBER(MATCH(A2:A19,F2:F6,0)))*(B2:B19*C2:C19))/SUMPRODUCT(--(ISNUMBER(MATCH(A2:A19,F2:F6,0))))
 
Upvote 0

Similar threads

Forum statistics

Threads
1,223,876
Messages
6,175,123
Members
452,614
Latest member
MRSWIN2709

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