Round to the nearest 10 in Excel or Open Office Calc

Is there a function, or does somebody have a formula or way of attacking these 3 problems, all in MS Excel (could also give an answer using Open Office Calc):  

(1) (a) How do you round to the nearest 10?  (b) Better yet, express the answer more generally.  So, the question, ideally, is, "How do you round to the nearest x, where x = a given, real number?"

(2) (a) How do you round up to the nearest 10?  (b) Same follow-up as in question (1).

(3) (a) How do you round down to the nearest 10?  (b) Same follow-up as in question (1).

I have Excel 2003.  I'd prefer an answer in Excel to one requiring Open Office Calc, but if there's a much easier way to do it in the latter, I'd be very interested in knowing that fact.  It will probably be easiest to follow this thread if people specify which problem they're addressing, for example, "Problem (2b)".

Thanks.
therearestupidquestionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pritamduttCommented:
Please see the following link for details on Round, RoundUp and RoundDown Functions of MS Excel

http://office.microsoft.com/en-us/excel-help/round-a-number-HP003056144.aspx#_Toc272405096

Also see the following link for reference on Round, RoundUp and RoundDown Functions of OpenOffice Calc

http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Calc:_ROUNDUP_function


Hope this helps!
0
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

=CEILING(A1,10)

will round a number UP to the nearest multiple of 10, for example

15      -->      20
11      -->      20
17      -->      20


To round down, you can use
=FLOOR(A1,10)

which will round a number DOWN to the nearest multiple of 10, for example

=FLOOR(A1,10)

15      -->      10
11      -->      10
17      -->      10

cheers, teylyn
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
You can use MOD() in an IF statement to decide whether to round up or down

=IF(MOD(A1/10,1)>=0.5,CEILING(A1,10),FLOOR(A1,10))


10       -->      10
11       -->      10
12       -->      10
13       -->      10
14       -->      10
15       -->      20
16       -->      20
17       -->      20
18       -->      20
19       -->      20
20       -->      20


cheers, teylyn
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

barry houdiniCommented:
If the number to round to is divisible by 10 (or 1 divided by a multiple of 10, like 0.1, 0.01, etc.) then you can use ROUND/ROUNDUP/ROUNDDOWN as already suggested. But if not then MROUND function allows you to round to the nearest n

=MROUND(number,n)

Note that MROUND is an "Analysis ToolPak" add-in function so that needs to be enabled in Excel 2003 (in later versions MROUND is a built-in function). To enable Analysis ToolPak use Data > addins > tick "Analysis ToolPak"

To avoid using MROUND this is a generic way to round to n using ROUND function,

=ROUND(number/n,0)*n

so to round to the nearest 4 that would be

=ROUND(number/4,0)*4

That exact same approach can be used with ROUNDUP and ROUNDDOWN to round up or down to the nearest n. CEILING and FLOOR are generally simpler, as per teylyn's suggestion, but note that if you want to round up negative and positive numbers you need to make sure that the "significance" argument has the same sign as the number to be rounded. YOu can do that with this formula

=CEILING(number,SIGN(number)*4)

regards, barry
0
therearestupidquestionsAuthor Commented:
Whoops!  Sorry.  I forgot I had this question open.  Let me try to review this stuff today.  I hope I have time to get to it.
0
Saqib Husain, SyedEngineerCommented:
Or maybe

Round
=INT((number+x/2)/x)*x

Round up
=INT((number+x)/x)*x

Round down
=INT(number/x)*x
0
barry houdiniCommented:
=INT((number+x)/x)*x

Hello Saqib,

I don't think that will work if number is a multiple of x, e.g. if number is 18 and x is 6 you'd expect a roundup function to return 18...but that would return 24.....

regards, barry
0
Saqib Husain, SyedEngineerCommented:
Thanks, Barry, I did not realize that.

Maybe we can modify it to

=INT(($F2+G$1*0.99999999)/G$1)*G$1

0
therearestupidquestionsAuthor Commented:
Please, no more comments for now.

I'm raising the point value to reward experts for their patience.

I'll review answers and award points ASAP.  I may have to post another post along these lines, before that time, to keep the question active.  However, I do appreciate people's responses, and nobody will be cheated out of points they deserve.  You just may have to wait a bit.

Sorry about this.
0
therearestupidquestionsAuthor Commented:
I bumped up the points to reward ongoing patience.

Thanks for waiting.
0
therearestupidquestionsAuthor Commented:
Again, I bumped up the points.

Thanks, all.
0
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
You said above:

>>Please, no more comments for now.

So, did you review the options presented? What is your result?
0
Saqib Husain, SyedEngineerCommented:
Hi teylyn, I think the OP is not yet ready to review the options. "No more comments..." could be because EE stalls the asker's ability to ask more questions if the experts' comments are waiting long enough.

Saqib
0
therearestupidquestionsAuthor Commented:
I will award points in the next 2 days.  I'm currently printing all the threads I have going, even as I write this.  I'll award 500 points total.

Thank you all for your patience and advice.
0
coreconceptsCommented:
Hello, I just read the posts that you probably have an answer, but I think this is a readable solution:



=IF(RIGHT(A2, 1)+0>=5, CEILING(A2, 10), FLOOR(A2, 10))
0
TracyVBA DeveloperCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Spreadsheets

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.