How do I make the CEILING function work to automatically assume a cell value is to the nearest even number?
Examples:
If I have a value of 4.25, how do I get it to automatically round to 6?
If I have a value of 6.25, how do I get it to automatically round to 8?
If I have a value of 7.25, how do I get it to automatically round to 8?
If I have a value of 9.25, how do I get it to automatically round to 10?
Thank you for your help
There is an alternative to CEILING using a little math and ROUNDUP.
=ROUNDUP(A1/2, 0)*2
It may be important to note how CEILING works with negative numbers. CEILING always rounds to the numerically larger number.
For the following examples, assume 3 in A1 and -3 in A2.
=CEILING(A1, 2) 'rounds up to +4
=CEILING(A2, 2) 'rounds up to -2
On the other hand, ROUNDUP always rounds away from zero.
=ROUNDUP(A1/2, 0)*2 'rounds up to +4
=ROUNDUP(A2/2, 0)*2 'rounds away from zero to -4
Conversely, ROUNDDOWN and FLOOR (the inverse of ROUNDUP and CEILING) operate in the same manner by in the opposite 'direction'.
Use CEILING(A1, 2). CEILING rounds the first parameter up to the nearest multiple of the second parameter.
Related
I am trying to capture items that are > 80% to multiply by 3, IF not, to multiply by the percentage given, then round up1]1. However, I'm receiving a message that I have too few arguments for this function.
=ROUNDUP(IF(H2>.79,G2*3*H2,IF(H2<.8,G2*3*H2,0)))
The RoundUP() requires two arguments. The second sets the place to which to round.
=ROUNDUP(IF(H2>.79,G2*3*H2,IF(H2<.8,G2*3*H2,0)),2)
This will round up to the hundredth place. The 2 is the significant diggits in the decimal. To do it to the Tens it would be -1. To the integer 0.
Your call to roundup requires two pieces:
a number to round
a number of decimal places to round to
You have only provided the first. By adding the bolded bit in the formula below (with whatever level of specificity you choose) it will run properly:
=ROUNDUP(IF(H2>0.79,G2*3*H2,IF(H2<0.8,G2*3*H2,0))**,0**)
I want to round off the value in Excel when the value is greater than 5 after decimal.
For example:
if num= 9.15, result= 9.1
if num= 9.16, result = 9.2
Although your need contradicts the currently valid rounding rules it could be achieved with the following formula:
=TRUNC($A1*10^1+0.4*SIGN($A1))/10^1
The value in A1 can be any decimal value in any length either positive or negative. It will be "rounded" to 1 decimal place. The 10^1 part in the formula leads to rounding to 1 decimal place. Use 10^2 to round to 2 decimal places and so on.
For the second decimal place, I was going to post
=IF(AND(FIND(".",A2&".")=(LEN(A2)-2),RIGHT(A2)="5"),--LEFT(A2,LEN(A2)-1),ROUND(A2,1))
(modified according to #Jasen's comment)
A very simple approach is
=ROUND(A4-10^-10*SIGN(A4),1)
which should be fine up to several places of decimals if you change the number of decimals to round (but will fail because of rounding errors if the numbers are too large).
This also gives good results over a wide range of numbers:-
=ROUND(A2-A2/10^12,1)
To generalise the first one a bit more you could try
=IF(ISNUMBER(FIND(".",A2)),IF(RIGHT(A2)="5",--LEFT(A2,LEN(A2)-1),ROUND(A2,LEN(A2)-FIND(".",A2)-1)),A2)
to round the last decimal place down if it's a 5.
this should do it
=ceil(A1*10-0.5)/10
I am trying to round up decimals to specific values in the following way:
1. 12.12 ---> 12.25
2. 12.5 ---> 12.5
3. 12.59 ---> 12.75
4. 12.75 ---> 12.75
5. 12.77 ---> 13
So they should be rounded up to the decimals .25, .5 and .75 or integer.
Is there an Excel function which can do this?
Please try:
=ROUNDUP(4*A1,0)/4
Your question uses positive numbers for sample data but there is a primary difference involving how negative numbers are handled by the CEILING function and the ROUNDUP function that should be mentioned.
This has to do with the way that ROUNDUP rounds away from zero and CEILING rounds to the numerically larger¹ number
The formulas in C2:D2 are:
=CEILING(A2, 0.25) ◄ C2
=ROUNDUP(A2*4, 0)/4 ◄ D2
Note the differences in the 7th, 9th and 11th rows. This is the difference in how the two functions handle rounding negative numbers. If you wanted the results in column C to follow the values in column D, you would have to use the following for negative numbers.
=CEILING(A2, -0.25) ◄ C2
But that doesn't work properly on positive numbers. While you could write a conditional statement that changed the sign of the significance parameter, it's a lot easier to choose what you want to happen with negative numbers and use either CEILING or ROUNDUP as the case may be.
¹If you get several mathematicians in a room and ask them if -1 is higher, larger or greater than -2, you will start World War III so I'm not going down that rabbit hole. The differences between CEILING and ROUNDUP are probably intended to cover both sides of the argument.
All of this can be related to the ROUNDDOWN function and the FLOOR function as well.
If you are only rounding to a fractional significance and not rounding in one direction or another, the MROUND function is another possibility.
I'm in need of a formula that rounds numbers differently depending on if the number is tens, hundreds, thousands, hundred-thousands, millions, etc. I know the basic rounding functions in Excel but not sure how to do this exactly.
Examples:
1 - 999 need to be rounded up to the nearest 10.
1.000 - 99.999 need to be rounded up to the nearest 100.
100.000 - 999.999 need to be rounded up to the nearest 1.000.
1.000.000 - 999.999.999 need to be rounded up to the nearest 100.000.
1.000.000.000 - 999.999.999.999 need to be rounded up to the nearest 1.000.000
And all this in single formula that can easily be copied down.
Any help would be greatly appreciated!
You can use ROUNDUP function with a LOOKUP function nested to give you the logic you need, i.e. with values in A2 down use this formula in B2 copied down
=ROUNDUP(A2,LOOKUP(A2,10^{0,3,5,6,9},-{1,2,3,5,6}))
This part
10^{0,3,5,6,9}
defines the lower bound of each range. And this part:
-{1,2,3,5,6}
gives the number of digits to round to, e.g. -2 gives next 100, -3 next 1000 etc.
This rounds up to the nearest multiple of 100 etc. so 134 will round to 140. If you want to round to the nearest multiple then you can use the exact same formula but with ROUND in place of ROUNDUP
Probably the best way to do it would be a custom VBA function switching between values - That would give you the most amount of control, but you could do it with nested IF() statements too:
=IF(A1<1000,CEILING(A1,10),IF(A1<100000,CEILING(A1,100),IF(A1<1000000,CEILING(A1,1000),IF(A1<1000000000,CEILING(A1,100000),CEILING(A1,1000000)))))
Hope that helps!!
I am looking for a function which can provide me between of CEILING and FLOOR.
For example, If the number is 20.67 it should give me 21 and if the number is 20.33 it should give me 20.
There are thousands rows of data I have and I cannot apply different methods on different columns, like FLOOR on one column and CEILING on other.
Is there anything available which can work out?
Thanks
ROUND() - tell it to round to 0 digits, e.g.:
=ROUND(11.54,0)
will show 12, but
=ROUND(11.44,0)
will show 11.
Yep, simply use round. The 2nd arugment would always be 0 in your case
=ROUND(cell_ref,0)