Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Convert number to nearest multiple of Five

Hello,

Is there a way that I can convert a number to its nearest multiple of
5?

like in A1.. A5 i have

281
288
291
297
298

I want in B1 .. B5

280
290
290
295
300

That is up the number or down to nearest multiples of five

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Convert number to nearest multiple of Five

You can use a formula like this...

=ROUND(A1/5,0)*5

Where 281 is in cell A1 it will return 280
--
HTH...

Jim Thomlinson


"Abdul" wrote:

Hello,

Is there a way that I can convert a number to its nearest multiple of
5?

like in A1.. A5 i have

281
288
291
297
298

I want in B1 .. B5

280
290
290
295
300

That is up the number or down to nearest multiples of five

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Convert number to nearest multiple of Five

The MROUND function is what you want, you have to go to Tools, Addins, and
add the analysis toolpack if you don't already, then

=MROUND(A1,5)
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Abdul" wrote:

Hello,

Is there a way that I can convert a number to its nearest multiple of
5?

like in A1.. A5 i have

281
288
291
297
298

I want in B1 .. B5

280
290
290
295
300

That is up the number or down to nearest multiples of five

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Convert number to nearest multiple of Five

Is there a way that I can convert a number to its nearest multiple of
5?

like in A1.. A5 i have

281
288
291
297
298

I want in B1 .. B5

280
290
290
295
300

That is up the number or down to nearest multiples of five


Use this...

=MROUND(A1,5)

and copy down.

Rick
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Convert number to nearest multiple of Five

Hey Abdul,

Homey!!!

VBRound can be used to round to the nearest "whatever" called with the
right argument of 5 it rounds to the nearest 5.

VBRound can be used from VBScript too.

Sub testVBRound()
v = Array(281, 288, 291, 297, 298)
For i = 0 To 4
MsgBox VBRound(v(i), 5)
Next i
End Sub

Function VBRound(a, b)
Result = ""
If 0 = b Then
Result = ""
ElseIf "" = b Then
Result = a
ElseIf 0 = a Then
Result = 0
Else
Result = b * ((a \ b) - CInt(((a Mod b) = (b / 2))))
End If
VBRound = Result
End Function




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Convert number to nearest multiple of Five

=ROUND(A1*2,-1)/2

Regards,
Bernd

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to correct the decimal number to the nearest even number santosh kutre Excel Worksheet Functions 3 November 3rd 08 04:04 PM
convert Inches to the nearest foot Mario454 Excel Discussion (Misc queries) 2 July 2nd 08 03:10 AM
Excel. How to round a number to nearest half number? HaraldS Excel Discussion (Misc queries) 2 February 19th 07 09:50 AM
How do I convert time to the nearest 1/4 hour with a 7 min. window Bigbus Excel Worksheet Functions 4 August 28th 06 03:09 PM
how do I convert numbers to the nearest 1000 Brian Excel Discussion (Misc queries) 2 February 8th 06 12:36 AM


All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"