Multiple MAX in one Excel function - excel

I am trying to find the formula on excel that will solve my problem.
I need to calculate X, which is equivalent to a percentage YĆ·2 (and X has maximum and minimum values which depend on Y)
We have that if Y is less than 500, X represents 25% of Y. In this case, X must take a value between 5 and 125.
If Y is between 500 and 1000, X represents 20% of Y. In this case, X must take a value between 125 and 200.
If Y is greater than 1000, X represents 15% of Y. In this case, X must take a value between 200 and 400.
In order to find the value of X based on the value of Y, I first used this formula (omitting the max and min values)
Y=A2
=IF(A2<500; A2*0,125; IF(A2<=1000; A2*0,1; IF(A2>1000; A2*0,075)))
Now I tried to incorporate in my formula the min and max and that's where I'm stuck
For the first part of the problem (Y<500), I applied this formula:
=MAX((IF(A2<500;A2*0,125));5)
Ideally I would have realized this formula:
=MAX((IF(A2<500; A2*0,125));5) ; MAX((IF(A2<=1000; A2*0,1));125) ; MAX((IF(A2>1000; A2*0,075));200)
But since I can't do it (Excel won't let me), would you have any alternatives to offer me?

Do you want to determine the percentage based on the value but set a minimum?
=IF(A2<500,MAX(A2*0.125,5),IF(A2<=1000,MAX(A2*0.1,125),MAX(A2*0.075,200)))

Related

Calculating contrast values on Excel

I am currently studying experimental designs in statistics and I am calculating values pertaining to 2^3 factorial designs.
The question that I have is particularly with the calculations of the "contrasts".
My goal of this question is to learn how to use the table "Coded Factors" and "Total" in order to get the values "Contrast" using the IF THEN function in Excel.
For example, Contrast A is calculated as : x - y . Where
x = sum of the values in the Total, where the Coded Factor A is + .
And y= sum of the values in the Total, where the Coded Factor A is - .
This would be rather simple, but for the interactions it is a bit more complex.
For example, contrast AC is obtained as : x - y . Where
x = sum of the values in the Total, where the product of Coded Factor A and that of C becomes + .
And y = sum of the values in the Total, where the product of Coded Factor A and that of B becomes - .
I would really appreciate your help.
Edited:
Considering the way how IF statements work, I thought that it might be a good idea to convert the + into 1 and - into -1 to make the calculation straight forward.
Convert all +/- to 1/-1. Use some cells as helper..
Put in these formulas :
J2 --> =LEFT(J1)
K2 --> =MID(J1,2,1)
L2 --> =MID(J1,3,1)
Put
J3 --> =IF(J$2="",1,INDEX($B3:$D3,MATCH(J$2,$B$2:$D$2,0)))
and drag to L10. Then
M3 --> =J3*K3*L3*G3
and drag to M10. Lastly,
M1 --> =SUM(M3:M10)
How to use : Input the Factor comb in cell J1 and the result will be in M1.
Idea : separate the factor text > load the multiplier > multiply Total values with multiplier > get sum.
Hope it helps.

Excel: Totaling where value is X or Y

I've got an excel spreadsheet where one of the values is X or Y. I want a function to add up the amounts column for all the Xs then the same for all the Ys. So in the example below, the calculation for all Xs would be 1080 and all Ys 1100.
X/Y: Amount
X : 500
Y : 600
X : 580
Y : 500
I'd then like to be able to calculate the mean and median of that figure, so for the mean, take the total of the Xs (1080) and divide by the number of cells with X (2). I don't know how to do this bit either.
Thanks in advance!
So lets assume you have the X and Y in Col A with the values in Col B.
We could use the following formula for the Sum of X:
=SUMIF(A1:A4,"X",B1:B4)
We could use the following formula for the Sum of Y:
=SUMIF(A1:A4,"Y",B1:B4)
As for the Mean we take the above formala and divide by countif like this:
=SUMIF(A1:A4,"X",B1:B4)/COUNTIF(A1:A4,"X")
=SUMIF(A1:A4,"Y",B1:B4)/COUNTIF(A1:A4,"Y")

How many X cells to add to reach Y%

I'm working on this: https://tempfile.me/download/nYhdQHD65GxRzk/ .
And I need to count how many 1 cells should be added to column A to reach a percentage of 1s = 85%.
This is just an example, I can't add cells with 1 and see how many of them I need since it should be automated on a big sample of data.
Expressed as:
.85(count + x) = sum + x
this renders down to x = ( (85 x count) - (100 x sum) ) / (100 - 85) or,
=(85*COUNT(A:A)-100*SUM(A:A))/(100-85)
However, this does not result in an integer, so to ensure 85% is reached:
=ROUNDUP((85*COUNT(A:A)-100*SUM(A:A))/(100-85),0)
The result (234) when added as 1s increases the TRUE total to 284 and the count of all entries to 334, where 284/334 is 85.03%.
It is a lot easier, if you don't look at the percentage which is TRUE or FALSE, but at the count of TRUE and FALSE.
In your example, you have 50 1's and 50 0's.
You want to see how many 1's you have to add in order to get a percentage of 1's of 85%.
In numbers this would look like this:
(x+dx)/(x+dx+y) = 0.85
where x is the number of 1's, y the number of 0's and dx the increase of 1's needed, to get to 85%.
You are looking for dx. So just solve for dx and you get:
dx = (0.85*y-0.15*x)/0.15
Which yields in your example an dx = 234. So you need to add another 234 1's in order to get a (minimum) 85% of 1's.
Hope this is what you wanted. It has however nothing to do with excel.

Excel - Multiply Until Total Reached

I want to multiply x*y until x>=20, then multiply z that value and have the results displayed as two values, the multiple and multiple*z
The question behind the formula is, how many boxes of x capacity do I need to have a total capacity of 20 liters and how much does that cost.
x = volume of bottle
y = number of bottles in a box
z = price per box
This could be done very easily by hand, but I've been playing (with little effect) in excel for a while and would like a solution.
I hope that makes sense
I rather think what you would like is the formula provided by #Jeeped but for:
I want to multiply x*y until x>=20, then multiply z that value and have the results displayed as two values, the multiple and multiple*z
label two arrays from 1 to 20 for columns and rows as shown, populate V1 with the price per box and in B2:
=IF(AND($A2*B$1>20,A2>=20),"",$A2*B$1)
and in X2:
=IF(B2="","",$V$1*B2)
with both formulae copied across 19 columns and those two sets of 20 formulae then copied down 19 rows. The result should be similar to:

How do I perform a monte carlo simulation in Open Office?

I am trying to generate some ranges for a problem I am working on. These rangers are going to be based on the sum of the ratio's of a bunch of numbers. So for example, the constant's are 5 6 and 7.
The ranges I get will be 5/x + 6/y + 7/z = S
I want x, y, and z to come out of a list of numbers I have - say .5, .6, .7, .8, .9, and 1
So If I run 100 iterations of this, I want the spreadsheet to randomly fill a value in X from that list of numbers, another random selection for y, and yet another for z.
And like I said, I want that sum, S, to be calculated 100 times in such a way that I will get a range of values for S.
I have been trying to figure out how to do this without the use of macros.
Here's one way to do it. Create a table of x, y, and z input values. Put a column to the left of the table with the number of each input value (1...N). Say that you have 10 potential input values for each. So your table is in A1:D10 with 1 through 10 in column A and the x values in B, y values in C, and z valued in D.
Then you can select a random value of the x values by writing =VLOOKUP(10*RAND()+1,$A$1:$D$10,2,TRUE). This randomly selects a number between 0 and 10 and looks up the x value matching the A column that matches the number, rounded down. E.g. the random number is 4.3 -- then it will select the 4th value. Replace the third parameter in the VLOOKUP column with 3 for y values and 4 for z values...
If you don't have any other data in columns A:D, you can generalize this with =VLOOKUP(count($A:$A)*RAND()+1,$A:$D,2,TRUE).

Resources