Excel: What to multiply by to get a specific result - excel

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.

Related

Conditional Formula for excel

I am trying to do addition/subtraction from a total of one column, based on the value of a different column.
Here are the details:
Column H2:H61 has 3 possible values: Complete, Incomplete, Does Not exist.
Column I2:I61 are integers.
What I'm trying to accomplish is, for each Row in column H, evaluate if the value is "Complete". If it is, then, in a running total cell, convert the corresponding Row in I to a negative number and add it to the total. If it isn't, leave the number a positive number and add it to the total.
Example:
H2 = "Complete" I2 = 1.5
h3 = "Incomplete" I3 = 0.5
h4 = "Complete" I4 = 2.0
The total is 3
EDIT
Here is the full scope of it:
Excel Screenshot
So, the total values of I and L is currently 40.
What I'm trying to do is, for example, if H2 = "Complete", then I want to subtract I2 (which is 1.5), which would change the total value to 38.5.
H3 is "Does Not Exist" and != "Complete", so the total would still be 38.5.
H4 is "Complete", so the total would be 37.5
so on and so forth. Hope this helps clarify for everyone!
Try following formula in K2 cell then drag and down.
=SUMIF($H$2:$H2,"Complete",$I$2:$I2)-SUMIF($H$2:$H2,"Incomplete",$I$2:$I2)
I guess you want something like:
=40-SUMIF(H:H,"Completed",I:I)
assuming you do not have the 40 total in either Column H or I.
I figured it out.
What I did was in a separate cell I made the following formula:
=SUMIF(H2:H61,"Completed",I2:I61)
From there, I used that cell to create the following formula to get the result I wanted:
=P31 - (S30+S31)
The S30 and S31 cells are there because I was counting for each "completed" value in two separate columns.

If formula between ranges and with several possible tags

Would anybody happen to know if possible to build the following formula?
(Dont know if its too complex to actually do through an IF function)
If "good" and number in second column is = to 1,4 or below then give X percentage discount. If between 1,41 and 1,47 then give X percentage discount. If between 1,48 and 1,57 then give X percentage. If equal to 1,58 or above then give X
If "Fair" and number in second column is = to 1,4 or below then give X percentage discount. If between 1,41 and 1,47 then give X percentage discount. If between 1,48 and 1,57 then give X percentage. If equal to 1,58 or above then give X
If "Attention" and number in second column is = to 1,4 or below then give X percentage discount. If between 1,41 and 1,47 then give X percentage discount. If between 1,48 and 1,57 then give X percentage. If equal to 1,58 or above then give X
If "Clearance" then give 80% discount
Make a table that has the values:
Then use an INDEX/MATCH/MATCH formula:
=INDEX(G:K,MATCH(A2,G:G,0),MATCH(B2,$G$1:$K$1))
Based on your previous question, try the below formula
=IF(C2<=1.4,IF(B2="Good",0.1,IF(B2="Fair",0.2,IF(B2="Attention",0.3,0.8))),
IF(AND(C2>=1.41,C2<=1.47),IF(B2="Good",0.12,IF(B2="Fair",0.22,IF(B2="Attention",0.32,0.8))),
IF(AND(C2>=1.48,C2<=1.57),IF(B2="Good",0.15,IF(B2="Fair",0.25,IF(B2="Attention",0.35,0.8))),
IF(B2="Good",0.18,IF(B2="Fair",0.28,IF(B2="Attention",0.38,0.8))))))
Format Column D as Percentage. Percentages assigned in the formula are based on the corresponding conditions listed in the image below.

Median Selling Price Excel Table

I have a spreadsheet with different products, listing units and retail value sold like the example below
Product Units Value
A 10 100
B 15 80
C 30 560
I'd like to compare the Average Selling Price with the Median Selling price, so I am looking for a quick formula to accurately calculate the median.
The median function requires the entire series, so for Product A above I would need 10 instances of 10 etc. How can I calculate the Median quickly considering the condensed form of my data?
Without writing your own VBA function to do this there are a couple of approaches that can be taken.
The first expands the data from its compressed frequency count format to generate the full set of observations. This can be done manually or formulaically. On the assumption the latter is required, it can be achieved using a few columns.
All the blue cells are formulae.
Column Eis simply the cumulative of column B and F is an adjusted version of this. Column H is just the values 1 to 55, the total number of observations given by cell L2. Column I uses the MATCH() with its final argument as 1 to match each observation in H against the adjusted cumulative in F. Column J uses the INDEX() function to generate the value of the observation. (Observations 1-10 have value 100, 11-25 have value 80 and 26-55 have value 560 in this example). The MEDIAN() function is used in cell M2 with column J as its argument.
This approach can be refined to take account of varying numbers of products and data points through the use of the OFFSET function to control the range arguments of the MATCH(), INDEX() and MEDIAN functions. And, of course, adjacent cells in columns I and J could be combined using a single formula - I've shown them separately for ease of explanation.
The second approach involves sorting the data by value (so in this case the data rows would become Product B in row 2, product A in row 3 and product C left as-is in row 4). It is then a case of identifying the middle observation number (if the number of observations is odd) or the middle pair of observation numbers (if the number of observations is even) and then determining the value(s) corresponding to this/these middle observation(s). In this approach the adjusted cumulative in column F is still used but rather than explicitly calculating the values in column I and J for every observation it can now be restricted to just the middle observation(s).
I think there is no way around compromises. Either using big amounts of helper cells or having the table sorted by the values.
Helper cells:
Formula in F4:AS6:
=IF(COLUMN()<COLUMN($F$4)+$B4,$C4,"end")
Formula in D2:
=MEDIAN(F4:AS6)
Sorted:
Formula in F4 downwards:
=SUM($B$3:B3)+1
Formula in D2:
=SUM(LOOKUP(INT(SUM(B4:B6)/2+{0.5,1}),F4:F6,C4:C6))/2

3 Variable Weighted Average in 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.

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