I am trying to write a rounding if statement. If cell <50 round to the nearest 5, if cell is >50 but <1000 round to the nearest 10, if cell is >1000 round to the nearest 100. Can anybody help me out?
My attempt
=IF((T2<50, ROUND(T2*2,-1)/2),IF(AND(T2>50,T2<1000,ROUND(T2,-1)),ROUND(T2,-2)))
I was able to write a similar statement (If cell >0 but <1000 round to nearest 10, otherwise round to nearest 50)
=IF(AND(S3>0,S3<1000),(ROUND((S3),-1)),(ROUND((S3)*2,-2)/2))
Try this:
=IF(A1<50,MROUND(A1,5), IF(AND(A1>=50,A1<1000),MROUND(A1,10),MROUND(A1, 100)))
The MROUND operator (documentation here) rounds to the nearest multiple, which I think is what you're looking for. You also have some issues with your paren grouping, but excel doesn't make it easy to chain if statements. Your AND statement needs to wrap just just the two evaluations and return MROUND(<cell>, 10) when true.
Did you just get a bit mixed up with the IF syntax?
=IF(T2<50, ROUND(T2*2,-1)/2,IF(AND(T2>50,T2<1000),ROUND(T2,-1),ROUND(T2,-2)))
The general form is
IF (logical test, result if true, result if false)
You also had some unnecessary brackets and didn't close the AND brackets.
Related
Here is my excel table:
The cell with 8.83 = =((C8-B8)*24)-D8
*C8 = 4:50PM
*B8 = 7:30AM
*D8 = 0.50
The cell $371.00 = =(E8*B3)
Why does my total show $371.00 when B3 = $42? It should be $370.86. I don't have it set to round but for some reason it keeps on doing it.
Because, the actual result of formula =((C8-B8)*24)-D8 is 8.833333333. Due to cell formatting you are seeing 8.83. If you want result for only two digit after decimal point then use round function like-
=ROUND(((C8-B8)*24)-D8,2)
Then you will get result 370.86. Or you can directly use in resulting cell.
=ROUND(E8,2)*B3
$371 is “technically” the correct amount, mathematically. You are actually doing rounding when you are hand-calculating your cross-check, and that isn’t matching Excel’s unfounded calculation.
( 4:50pm - 7:30am ) is 9.3333333 repeating, or “9-1/3”. Divided by 24 leaves you 8.8333333 repeating, not 8.83. Excel is doing what it’s supposed to do, and 371.00 is the correct amount. If your use case calls for times to be rounded to .01 hours and no further then you’ll need to apply rounding somewhere in cell E8.
I am trying to make a number round up or round down depending on if it's higher or lower than 0.8
If the number in U6 is for example 16.8, I want cell V6 to round UP to 17.
If the number in U15 is 14.33 I want V15 to round DOWN to 14.
If the number to be rounded will always be positive, then try:
=ROUND(U6-0.3,0)
Use simple round formula like below.
=ROUND(U6,0)
Round() formula with 0 decimal place will automatically round up greater than .5 to its upper integer and round down less than .5 to lower integer.
Try below formula.
=INT(U6)+((U6-INT(U6))>=0.8)
Depending on the condition put in (U6-INT(U6))>=0.8 the formula will return TRUE or FALSE which will be coerced into 1 or 0 due to arithmetic operation.
Sorry, this is as basic as it gets.
However, I have trouble with understanding the math behind this Excel formula:
=((X*(1+1%)^25)*12*25)
X is a cell reference. Can someone illuminate me what's the math? I can't understand how that percentage works and the associativity...
When X=97.5 the result is 37511.
If you don't understand a formula, break it down into parts and apply BODMAS, Brackets, Order, Division and Multiplication, Addition and Subtraction.
(1+1%) is evaluated first, this equals 101% or 1.01
Next you take 1.01 to the power of 25 which is 1.2824.....
X multiplied by 1.2824.... which if X = 97.5 you get 125.037.....
List item Lastly you multiply this by 12 (= 1500.4454....), then 25, you get 35711.135....
The power (order) of 25 is done before the multiplication as it's within the same set of brackets as the multiplication and Order takes precedence over Multiplication.
My IF statement:
=IF(AL23*0.2=AM23,"a","r")
Calculates VAT to 3 decimal places so when its checking with AM23 it is returning a false as I only have VAT to 2 decimal places.
How can I make the IF statement only calculate the AL23*0.2 to 2.dps?
You can round it like this:
=IF(ROUND(AL23*0.2,2)=AM23,"a","r")
Use ROUND, which rounds the first argument to the number of decimal places specified by the second argument
=IF(ROUND(AL23 * 0.2, 2) = AM23, "a", "r")
Consider ROUNDDOWN or ROUNDUP for other rounding behaviour: ROUND will round half-way cases and higher upwards.
(Also, consider not hardcoding the VAT rate in a formula in case it changes in the future.)
The round function should work
round(AL23*0.2,2)
so the full statement should be:
=IF(round(AL23*0.2,2)=AM23,"a","r")
Can MS Excel do rounding but only up to the nearest thousandths place and ignore the rest of the decimals in a formula? I've tried value, fixed, round and none of these do what I need.
Let's say I have 100 square feet of space and I pay $1.00566399 per sq foot, I need the formula to round only up to the 5 and ignore the rest of the numbers because when you speak on longer terms it makes a difference in rate.
So I should be multiplying 100sf by $1.01 = $101.00 and not get 100sf * 1.00566399 = $101.57
=trunc(A1,5)
If you want to round up, maybe something like
=trunc((A1*10000+1)/10000,5)
Use the TRUNC($cellRef or number, Decimal places) function. It reduces the number of decimal places WITHOUT rounding, then do your math.
So for example:
=TRUNC(1.00566399,3)
=A1*ROUNDUP(B1,2)
Where A1 contains the number of square feet and B1 contains the price per square foot in it's original long decimal form.