Can you do a formula, then include a nested IF statement? - excel

I was trying to do a formula to see if I should or not not have a bet on something.
The formula divides two cells, then -1, then multiplies by 100 to get a percentage. If this percentage is greater to or equal to 10, I want it to say bet, if not, I want it to say Don't bet. Here is what I can't get to work now.
=IF(SUM((D27/C27)- 1) * 100) >= 10, "BET", "DON'T BET")

Your formula contains an error
=IF((SUM((D27/C27)- 1) * 100) >= 10, "BET", "DON'T BET")
^ You are missing a bracket here.

Related

IF function in Excel - giving errors

I want to writte an If function with the following condition:
80% > value then 0 point
85% > value >= 80% then 1 point
90% > value >= 85% then 2 points
95% > value >= 90% then 3 points
97.5% > value >= 95% then 4 points
value >= 97.5% then 6 points
This is what I wrote, but I got an error for cases < 97.5%. I don't know where I did wrong. Please help
" =if(value >=97.5%,6,IF(AND(value >=95%,value <97.5%,4,IF(AND(value >=90%,value <95%),3, IF(AND(value >=85%,value <90%),2,IF(AND(value >=80%,value <85%),1,0)))))) "
By restructuring your IFs, you can do away with the need to check the upper bounds of each band, and therefore the ANDs which are less efficient.
Please see the formula below where your value is in cell A1:
=IF(A1 >= 97.5%, 6,
IF(A1 >= 95%, 4,
IF(A1 >= 90%, 3,
IF(A1 >= 85%, 2,
IF(A1 >= 80, 1, 0)
)
)
)
)
P.S. You can add new lines in the Excel formula bar by holding Alt and pressing the Enter key. This allows you to format your formulas to make them easier to read.
Easy Updates With Reference Table
The solution above is fine, if it is a one off formula that won't change often. However, if you have the formula repeated in numerous places and may need to change the cut offs or points associated with them often, it will quickly become labourious and error prone to find and update all the formulas.
The answer to this is to keep the cut offs and points in a separate reference table (which could be kept on a hidden sheet) and use a formula to look up the number of points that should be awarded. That way, you only have to update the table, and not each formula.
=INDEX($E$2:$E$7,MATCH($A$1,$D$2:$D$7,1))

How can I express easily a formula that has a lot of nesting Ifs

I want to express a formula that says if a number in a column is 50 to 99, then return 50. If 100-149, then return 100, 150-199, then return 150, etc, etc. I need a more concise way to do that for numbers that could reach 2000 (in 50 increments).
Right now my formula is =if(and >50 <100),50,if >100,100,true,0) or something like that, I can't see if right now.
There's probably a faster way, but here's what I would do:
Create a new column that rounds down to the nearest 50:
Assume the numbers are in Column A:
=CONCAT(FLOOR(A2,50),"-",IF(FLOOR(A2,100)-1<FLOOR(A2,50),FLOOR(A2,100)+99,FLOOR(A2,100)-1))
This will produce, for every row, the nearest 50 and nearest 100-1. Also, it allows you to go to 10,000, 50,000, 100,000 and never have to change this formula.
The only thing is adding another nested if for any number below 50, but that's up to you. Otherwise, it shows as 0-99 for any number under 50 and 50-99 for any number below 99 but above 50.
Edit
I found out, after all that work, that you just wanted it rounded down to the nearest 50. Just use =FLOOR(A2, 50)
Divide the number by 50, then multiply the integer of that by 50:
=INT(A1/50)*50
Or subtract half the number and use MROUND:
=MROUND(A1-25,50)

Get sum of 3 large values out of 4 in MS Excel

I need to calculate the best 3 marks of class test assignment and get the sum of them in Excel. I am wondering what would be the formula for this. For the reference I have added an image below:
I want among (17, 1, 19, 20) I get (17, 19, 20) and the sum (17+19+20) = 56 put it in final marks column
Since you have only 4 items, it can be calculated like this
=SUM(B3:E3) - MIN(B3:E3)
You can use the LARGE() function to get the largest, second largest, third largest values and sum them all up.
=SUM(LARGE(B3:F3,1),LARGE(B3:F3,2),LARGE(B3:F3,3))
I use this to get best 4 out of 6:
=SUM(LARGE(N4:S4,{1,2,3,4}))
which for your three becomes:
=SUM(LARGE(B3:F3,{1,2,3}))
But I don't enter it as an array formula, works just fine dragged down as necessary.

How can I round up a number in cell to specific number in Excel

I have some product prices like
30,56
25,34
26,88
30,13
I want to to round them with a 0,50 limit
if the number is over x.50 to make it x.90 and if not make it x.50
is it possible with a function of VBA?
Alternate solution:
=INT(A1)+0.5+0.4*(MOD(A1,1)>0.5)
Use this formula to round:
=IF(A:A-INT(A:A)>0.5,INT(A:A)+0.9,INT(A:A)+0.5)
Explanation
It subtracts the integer part of the floating number so and tests if this is >0.5 so A:A-INT(A:A)>0.5 means (30.56 - 30) > 0.5 which is0.56 > 0.5
The formula means something like that:
If (30.56 - 30) > 0.5 Then (30 + 0.9) Else (30 + 0.5)
Use IF, MOD and RoundDown
=IF(MOD(A2,1)>0.5,ROUNDDOWN(A2,0)+0.9,ROUNDDOWN(A2,0)+0.5)
You may want additional conditions to handle fringe cases like a price of 0.

Excel Nested IF Statement Trouble

=IF(J4 >= 20, A, IF(J4 < 20 AND J4 > 13, B, IF(J4 < 14 AND J4 > 8, C, IF(J4 < 8, D,0))))
The numeric values = points
The values A - D is a scoring systems that rates a person based upon their points and gives them a value from A-D.
I've been stuck on this formula for a long time and have no idea what I'm doing wrong, all help would be appretiated!
Try this:
=IF(J4 >= 20, "A", IF(J4 > 13, "B", IF(J4 > 8, "C", "D")))
Here is a formula:
=IF(20<=J4,"A",IF(13<=J4,"B",IF(8<=J4,"C",IF(J4<8,"D",0))))
You may consider to update your statement as follows.
=IF(J4<8,"D",IF(J4<14,"C",IF(J4<20,"B","A")))
You can see that it's important in this case to move in one direction, either low to high, or high to low. This allows us to return a result whenever a test returns TRUE, because we know that the previous tests have returned FALSE.
I think the syntax you're using for the AND function is wrong. You need to nest all the parameters you want to use within the AND function. like this:
=IF(AND(J4<20,J4>8),"true","false")
Another apporach assuming that the possible inputs in J4 are integers below 1000:
=IFERROR(INDEX({"A";"B";"C";"D"},MATCH(J4,{1000;19;12;7},-1)),0)
I think this one is easier to read and to maintain.

Resources