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.
Related
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")
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.
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.
can someone please translate this excel spreadsheet cell formula in english words ?
=ROUND(IF(F28 < 1568,2.5,IF(F28 < 2491,0.004873 * F28-5.142,0.02269*F28^0.7329)),2)
am creating a program based from that formula, but i don't understand which one will go first. atleast i understand this part IF(F28 is less than 1568) ...then what?
Start from the outer if statement and move inwards. The comma in the IF function separates the statements like :
boolean expression, true part, and false part
The following is the psuedo code of the above. All the Round are to two decimal places.
IF (F28 < 1568) THEN
ROUND (2.5)
ELSE IF (F28 < 2491) THEN
ROUND (0.004873 * F28 - 5.142)
ELSE
ROUND (0.02269 * F28^0.7329)
If the value in cell F28 is less than 1568, then the value in this cell will be 2.5 rounded to 2 decimal places - i.e. 2.5
If the value in cell F28 is 1568 or more, but less than 2491, then the value in this cell will be:
0.004873 multiplied by [the value in cell F28 minus 5.142], rounded to 2 decimal places
Otherwise (i.e. the value in cell F28 is 2491 or more) the value in this cell will be: 0.02269 multiplied by [the value in cell F28 to the power of 0.7329], rounded to 2 decimal places
You will round the following in this order:
Smaller than 1568 = 2.5
Bigger than/Equal 1568 but smaller than 2491 = 0.004873 * F28-5.142
Bigger than/Equal 2491 = 0.02269*F28^0.7329
Basically that means this:
IF F28 is smaller than 1568 then use 2.5
IF F28 is larger or equal to 1568 but smaller than 2491 then use 0.0004873 * F28 - 5.142
IF F28 is larger or equal to 2491 then use 0.02269 * F28^0.7329
Round the outcome to 2 digits.
Probably the title is not very suggestive.
Let me explain you with an example. I have:
12345.6
2345.1
12345.00000001
I want those numbers to be roundup to 12350.
How can I do this?
If possible, I would rather use formulas instead of VBA.
You could also use CEILING which rounds up to an integer or desired multiple of significance
ie
=CEILING(A1,10)
rounds up to a multiple of 10
12340.0001 will become 12350
Use ROUND but with num_digits = -1
=ROUND(A1,-1)
Also applies to ROUNDUP and ROUNDDOWN
From Excel help:
If num_digits is greater than 0 (zero), then number is rounded to the specified number of decimal places.
If num_digits is 0, then number is rounded to the nearest integer.
If num_digits is less than 0, then number is rounded to the left of the decimal point.
EDIT:
To get the numbers to always round up use =ROUNDUP(A1,-1)
You can use the function MROUND(<reference cell>, <round to multiple of digit needed>).
Example:
For a value A1 = 21 round to multiple of 10 it would be written as
=MROUND(A1,10)
for which Result = 20
For a value Z4 = 55.1 round to multiple of 10 it would be written as
=MROUND(Z4,10)
for which Result = 60
the second argument in ROUNDUP, eg =ROUNDUP(12345.6789,3) refers to the negative of the base-10 column with that power of 10, that you want rounded up. eg 1000 = 10^3, so to round up to the next highest 1000, use ,-3)
=ROUNDUP(12345.6789,-4) = 20,000
=ROUNDUP(12345.6789,-3) = 13,000
=ROUNDUP(12345.6789,-2) = 12,400
=ROUNDUP(12345.6789,-1) = 12,350
=ROUNDUP(12345.6789,0) = 12,346
=ROUNDUP(12345.6789,1) = 12,345.7
=ROUNDUP(12345.6789,2) = 12,345.68
=ROUNDUP(12345.6789,3) = 12,345.679
So, to answer your question:
if your value is in A1, use
=ROUNDUP(A1,-1)