user3125707
user3125707

Reputation: 409

Round up decimals to fractional multiple

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?

Upvotes: 4

Views: 160

Answers (2)

user4039065
user4039065

Reputation:

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

          CEILING vs ROUNDUP

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.

Upvotes: 1

pnuts
pnuts

Reputation: 59450

Please try:

=ROUNDUP(4*A1,0)/4

Upvotes: 3

Related Questions