Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
custom round function
I'm writing a function to change the last integer in a numeric value t
either a 5 or a 9-(replicating a Peachtree function). The Select case functions is clearly an option, but how do I get th function to focus on the last integer ? The * doesn't work- example: Change 1442 to 1445 1327.55 to 1329 thanks -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
custom round function
On Fri, 16 Jan 2004 21:31:23 -0600, Princess Geek
wrote: I'm writing a function to change the last integer in a numeric value to either a 5 or a 9-(replicating a Peachtree function). The Select case functions is clearly an option, but how do I get the function to focus on the last integer ? The * doesn't work- example: Change 1442 to 1445 1327.55 to 1329 LastDigit = WorksheetFunction.Round(rg, 0) Mod 10 will give you the last digit of a rounded number. Something like: ====================== Function Round59(rg As Range) As Long Dim LastDigit As Integer LastDigit = WorksheetFunction.Round(rg, 0) Mod 10 Round59 = WorksheetFunction.RoundUp(rg / 5, 0) * 5 Round59 = Round59 + (LastDigit 5) End Function ======================== might do what you are looking for. --ron |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
custom round function
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
custom round function
On Sat, 17 Jan 2004 07:12:22 -0600, Princess Geek
wrote: worked beautifully, thanks! You're welcome. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Round to thousands via custom format? | Excel Worksheet Functions | |||
Round Len Function Help | Excel Worksheet Functions | |||
Format divide by 10 / single digit view: Custom? Text(Round( | Excel Discussion (Misc queries) | |||
Custom formats to round numbers such as 16,465,123 to 16,500,000 | Excel Discussion (Misc queries) | |||
Custom formats to round numbers such as 465,123 to 465,000 | Excel Worksheet Functions |