Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default custom round function

worked beautifully, thanks!

PG


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
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
Round to thousands via custom format? znelson Excel Worksheet Functions 3 June 7th 07 03:51 PM
Round Len Function Help [email protected] Excel Worksheet Functions 16 August 25th 06 04:27 AM
Format divide by 10 / single digit view: Custom? Text(Round( nastech Excel Discussion (Misc queries) 0 June 27th 06 11:03 PM
Custom formats to round numbers such as 16,465,123 to 16,500,000 davey888 Excel Discussion (Misc queries) 8 March 17th 06 12:49 AM
Custom formats to round numbers such as 465,123 to 465,000 malcolmt Excel Worksheet Functions 2 February 8th 06 12:46 AM


All times are GMT +1. The time now is 08:57 AM.

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

About Us

"It's about Microsoft Excel"