Weighted Average

cflorackis

Board Regular
Joined
Aug 18, 2002
Messages
137
Dear all,

I have a large dataset that includes information on the investment payout ratios of US companies over the period 2004-2006. I need to calculate the weighted average investment ratio for each company---see sample below
example.xls
ABCDE
1companyInvest_2006Invest_2005Invest_4Weighted average
2A10847.8
3B201016
4C35N/AN/A35
5DN/A686.8
6E5N/A13.4
Sheet1


The corresponding weight for each year must be as follows: 0.5 for 2006, 0.3 for 2005 and 0.2 for 2004. Then, for company A, the weighted average will be: (0.5*B2)+(0.3*C2)+(0.1*D2) = 7.8 (see cell E2)

The problem is that for some companies there are missing data for some years. For example, for company B, there are no data available for year 2004. In this case , the weights have to change to 0.6 for 2006 and 0.4 for 2005. Then, the weighted average investment for company B will be (0.6*B3)+(0.4*C3) = 16 (see cell E3). Similarly, in cases when there are data for only 1 year , the weight has to change to 1. Then, for company C the weighted average is 35 (see cell E4)

Is there any formula to give me the weighted average as it appears in column E without having to adjust it for each single case?

many thanks in advance for your help

C.
 
How about this simply inelegant formula:

=IF(COUNT(B2:D2)=3,B2*0.5+C2*0.3+D2*0.1,IF(COUNT(B2:D2)<=1,SUM(B2:D2),IF(NOT(ISNUMBER(B2)),C2*0.6+D2*0.4,IF(NOT(ISNUMBER(C2)),B2*0.6+D2*0.4,B2*0.6+C2*0.4))))
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
sorry, still i cannot make it work----can you please provide the spreadsheet to see how it works in your case?
 
Upvote 0
Hi btadams,

this one works perfectly!!!

many thanks to all of you, it is really great receiving suggestions from so clever people in this forum

C.Ven
 
Upvote 0
Sorry for not replying sooner, turned out it was a bit more complicated than I thought.

I think the solution from btadams is basically correct, but doesn't appear to deal with the twin #NA values on line 4. It also has a minor error in that the weight for 2004 is 0.1, which is an error from the OP.

Here's my suggestion -
Code:
=IF(COUNT(B2:D2)=3,(B2*0.5)+(C2*0.3)+(D2*0.2),IF(ISNA(B2),IF(ISNA(C2),D2,C2-(C2-D2)*0.4),IF(ISNA(C2),IF(ISNA(D2),B2,B2-(B2-D2)*0.4),B2-(B2-C2)*0.4)))

Slightly shorter than btadams' suggestion, and deals with the NA values.
 
Upvote 0
I am sorry. My formula was in european settings, that mean you need to change all semi-colon ";" with comma ","

If you do that, it should work.
 
Upvote 0

Forum statistics

Threads
1,215,840
Messages
6,127,214
Members
449,369
Latest member
JayHo

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