3 Variable Weighted Average in Excel - excel

I have 3 variables that I need to take a weighted average of.
I want to excel to calculate all possible combination of weights by .01 increments.
I have three columns in excel. Weight A, Weight B and Weight C. Weight A = 1-sum(Weight B + Weight C).
Fix Weight C to .01, Cell in column B will be = cell above + 0.01 (where the very first cell is just a value cell of 0.01)
This works, but then I have to manually search for where Weight A becomes negative and then manually change the cell in column B back to 0.01 (next cell continues the formula of cell above + 0.01), and then manually change the cell in column C to 0.02 and drag it down.
As you can see, I would have to do this for C=.03, .04, .05 ....etc. And then fix column B as .01, .02, .03 etc.
Is there a faster way of doing this? i.e. Excel finding all possible combinations of the sum of 3 cells summing to one?
Thanks in advance.

I believe I have a grasp on what you are trying to accomplish. Would your results look similar to the following?
        
The formulas in A2:C2 are,
=1-SUM(B2:C2) ◄ A2
=IF(SUM(A1)=0, 0.01, B1+0.01) ◄ B2
=IF(SUM(A1)=0, MAX(C$1:C1)+0.01, C1) ◄ C2
Fill down as necessary.

Related

I'm trying to reduce ten columns of Excel formulas into one cell with one large, nested command if possible

Weights
I have built a tab in an Excel spreadsheet that uses base data from 6 columns and then formulas in 9 additional columns that determine the final result in another column, which then gets copied into another cell on another tab (see 'weights' picture at top of this post):
The base data is in 6 columns A-F and has 729 rows - each column has a certain weight (30%, 20%, 20%, 10%, 15%, 5%). Each cell is either 1, 2, 3, 4, 5, N/A, or blank. The goal is to look for N/A or blanks and then redistribute the weight for those categories to the remaining non-N/A and non-blank categories, so if the 20% column was N/A and the other 5 columns were 1, 2, 3, 4, or 5, I would add 4% to each of the 5 scored categories to calculate the final score. Everything works great but I am interested in doing everything in one column after the 6 base columns. I start by converting N/A to 0 and then handle things in multiple columns by doing this:
In Column G, I get the total weight of the columns with N/A or 0:
=SUMIF(A2:F2,0,$A$729:$F$729)
Then in Column H, I get the number of columns that the weight percentage in Column G will get distributed to:
=COUNTIF(A2:F2,">0")
Then in Column I, I calculate the percentage to be added to the remaining columns:
=IF(H2=0,0,SUM(G2/H2))
Then in Columns J-O, I calculate the new weight percentages for each weight (the original weight percentages are in cells H2-H7 on a different tab called 'Controls':
=SUM(Controls!$H$2+$I2) is for Column J, =SUM(Controls!$H$3+$I2) is for Column K, etc.
Then finally I calculate the 'new' score with the 'new' weights. If there were no N/A or 0's, it keeps the original overall score and if not it multiples the score in a cell (1,2,3,4,5) by the new weight and adds the six totals together:
=IF(H2=6,Q2,SUM(A2J2)+(B2K2)+(C2L2)+(D2M2)+(E2N2)+(F2O2))
It all works great, but how can do what I'm doing in 10 columns with just one statement in one cell? I'm assuming there are lots of elegant references and nesting required but I'm not sure how to do it.
Thanks in advance!
You can do this step by step:
e.g.
cell (G2) =SUMIF(A2:F2,0,$A$729:$F$729)
cell (H2) = COUNTIF(A2:F2,">0")
cell (I2) =IF(H2=0,0,SUM(G2/H2))
In cell I2 replace the cell references of G2 and H2 with the formula expression of the respective cells.
More elegant with LET:
https://support.microsoft.com/en-us/office/let-function-34842dd8-b92b-4d3f-b325-b8b8f9908999

Excel: Rounding up Nearest value

Click HERE for excel file.
In the Excel file based on Column B values I am finding nearest up offer price range which is in Row number 2 in Grey Color, Offer price per sqm is incremental by $50. As you can see in Yellow color values are multiplied by offer price * Land sqm.
3rd property nearest offer price range is $750. As you can see I am using multiple columns from C, D, E, F.
Instead what I want is get the "Offer Price per/sqm" value in column "G". How to do that.?
Though you are not pretty clear about the output you want, I think you want to round the offer price to nearest 50. If so, use this in G3 (and copy down)
=MROUND(A3/B3, 50)
this will return $700 as nearest offer price. However, if you want to round only upwards i.e. towards $750, use this (and copy down)
=CEILING(A3/B3, 50)
If you want either of these formulae to return values between 650 and 800 only use either of these
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50), "NA")
Based on your comment, perhaps you need this?
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50)*B3, "NA")
I wonder if this is what you want.
[G3] =B3*INDEX($C$2:$F$2,1,MATCH("x",C3:F3,0))
You would mark the appropriate column with an "x" and the formula would multiply the price in row 2 of the first marked column with the number of sqm.
To simulate your example, an "x" would be placed inE3 and F3. The formula in G3 would ignore the F3 and show the price based on E2. If you add an "x" in D3 the lower price will be shown in G3.

Average certain cells based on criteria

my excel sheet
Basically I want to lump all strikes together by certain delta ranges and average them. I am trying to do this in the V5:X19 area.
I want to average all values in column G based of what is in column C given the same row
So in cell X6 I would like the formula to say "Average of all strikes widths(column G) in-between -3 and -1.1." and for it to copy down to average all widths with delta(column C) between -1.1 and -0.55, -0.55 and -0.25, ect.
Can anyone help?
Try this(untested) in cell X6.
=averageifs(G:G,C:C,">="&V6,C:C,"<"&V7)
=SUMIFS(C:C,,">="&V6,C:C,"<"&W6)/COUNTIFS(C:C,">="&V6,C:C,"<"&W6)

Excel: What to multiply by to get a specific result

How do I make a formula that calculates what to multiply by in order to get a specific result?
Let's say I want to bet 100 at odds 2. This gives me 200, with a profit of 100.
What if the odds is 3 (or any other number). How much would I have to be to keep a profit of 100?
It sounds really simple, but I just can't figure it out...
Given k (e.g. 2 or 3) you want to solve the equation kx - x = 100. But this is just (k-1)x = 100 so x = 100/(k-1). If the odds (k) are in cell A1 and the target profit (e.g. 100) is in cell A2 then in cell A3 you can put the formula =A2/(A1-1). Obviously, you don't have to use those specific cells.

Averaging daily varying column in excel vb

Every day I have to analyze two cols of numbers.
Cols differ each day.
Col 1 has no.'s from 1 to 5, eg. Day 1 there are 150 x 1's and 200 x 2's, etc. Day 2, 350 x 1's and 85 x 2's etc.
Col 2 has values between 1 and 99.
I need to count how many 1's there are to obtain a 1's average, 2's ave., etc. So far I have tried to write a vb program (excel 2010) - I have written the following:
Function Phil2()
ct = 0
For X = 2 To 10
If ax = 1 Then Let b15 = b15 + bx
ct = ct + 1
Next
End Function.
But I cannot get it to display. Can anyone help me?
I want the average of the 1's in cell b15.
See the formula bar for what is in cell E1. If you don't have XL2007 or above, the formula becomes:
=IF(ISERROR(SUMIF($A$1:$B$10,D1,$B$1:$B$10)/COUNTIF($A$1:$B$10,D1)),"",SUMIF($A$1:$B$10,D1,$B$1:$B$10)/COUNTIF($A$1:$B$10,D1))
You could also make more "automated" by using Dynamic Named Ranges for your ID (1,2,3..) and data (%) sets, that change each day.
OK, It works fine - I modified your formula to:
=IFERROR(AVERAGEIFS(B$16:B$500,$A$16:$A$500,$A2,B$16:B$500,">0"),"")
and it works perfectly for values 1, and 2. So that's a great start. I placed the formula cells on top: so in a1 I typed cow no., in b1 %Milk, in c1 %weight, etc.. In a2 I typed 1, a3 2, a4 3 etc.. In b2 your formula etc.. My next challenge is to lump together all cow types 3 to 11. So next to cow type 1 we have a % for each category, same for cow type 2, etc.. But the 3rd row must have an average for all categories 3+. Raw data cow types are in a10 down, vals in b10, c10, etc.

Resources