Avatar of therearestupidquestions
therearestupidquestions
Flag for United States of America asked on

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.
SpreadsheetsMicrosoft ExcelLibreOffice

Avatar of undefined
Last Comment
Tracy

8/22/2022 - Mon
SOLUTION
pritamdutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

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
SOLUTION
barry houdini

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
therearestupidquestions

ASKER
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.
SOLUTION
Saqib Husain

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
barry houdini

=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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Saqib Husain

Thanks, Barry, I did not realize that.

Maybe we can modify it to

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

therearestupidquestions

ASKER
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.
therearestupidquestions

ASKER
I bumped up the points to reward ongoing patience.

Thanks for waiting.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
therearestupidquestions

ASKER
Again, I bumped up the points.

Thanks, all.
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

You said above:

>>Please, no more comments for now.

So, did you review the options presented? What is your result?
Saqib Husain

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
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
therearestupidquestions

ASKER
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.
coreconcepts

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))
Tracy

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.