LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default I want to round Int to quarter

I have a column of numbers: 4.29, 5.79, 6.34, 7.89 and so on

I got a CustomRound function but it doesn't work right. I want to be
able to round the above numbers to the nearest quarter. I suspect that
either I need to use a case statement or more If Then statements. Can
anyone point me in the right direction.

Thank you, Mark

Function CustomRound(pValue As Double) As Double
Dim LWhole As Long
Dim LFraction As Double

'Retrieve integer part of the number
LWhole = Int(pValue)

'Retrieve the franction part of the number
LFraction = pValue - LWhole

If LFraction < 0.5 Then
CustomRound = LWhole
Else
CustomRound = LWhole + 0.5
End If


End Function

 
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 can I round in quarter points? frumious Excel Worksheet Functions 4 July 10th 06 08:46 AM
How do I round time to the nearest quarter of an hour Meghan New Users to Excel 6 July 7th 06 06:36 PM
Need to round the time to the nearest quarter hour. Help John Excel Discussion (Misc queries) 1 February 11th 06 06:41 AM
round numbers to the nearest quarter? LeelooIvy Excel Worksheet Functions 3 May 14th 05 07:34 PM
Round time to nearest quarter hr John Excel Worksheet Functions 2 March 16th 05 09:41 PM


All times are GMT +1. The time now is 03:38 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"