PC Review


Reply
Thread Tools Rate Thread

Access specific Round Down function

 
 
Lucky
Guest
Posts: n/a
 
      15th Jun 2004
I need to create an Access only Round Down function.
This function must round down every number. Therefore,
if the number is 9.031 or 9.99949 the result still must
be 9.

I have been using Excel RoundDown function, but the
queries are becoming rather large and this function slows
down the processing intolerably.

Here is the function I have used:

Function xlRoundDown(dblNumber As Double) As Long
'Round number down using Excel RounDown function
Dim objExcel As Excel.Application

Set objExcel = CreateObject("Excel.Application")
xlRoundDown = objExcel.Application.RoundDown
(dblNumber, 0)

objExcel.Quit
Set objExcel = Nothing
End Function

I am familiar with Microsoft Knowledge Base Article
209996, but it does not do the trick.

Any help is greatly appreciated.

Lucky

 
Reply With Quote
 
 
 
 
Brian Camire
Guest
Posts: n/a
 
      15th Jun 2004
You might try using the built-in Int or Fix functions. They would round
down both 9.031 and 9.99949 to 9. They differ in how they handle negative
numbers. Int rounds (truncates) away from zero, and Fix rounds (truncates)
towards zero. For example:

Int(-9.031) would return - 10

where as

Fix(-9.031) would return 9.



"Lucky" <(E-Mail Removed)> wrote in message
news:1ca9c01c452d6$e7715620$(E-Mail Removed)...
> I need to create an Access only Round Down function.
> This function must round down every number. Therefore,
> if the number is 9.031 or 9.99949 the result still must
> be 9.
>
> I have been using Excel RoundDown function, but the
> queries are becoming rather large and this function slows
> down the processing intolerably.
>
> Here is the function I have used:
>
> Function xlRoundDown(dblNumber As Double) As Long
> 'Round number down using Excel RounDown function
> Dim objExcel As Excel.Application
>
> Set objExcel = CreateObject("Excel.Application")
> xlRoundDown = objExcel.Application.RoundDown
> (dblNumber, 0)
>
> objExcel.Quit
> Set objExcel = Nothing
> End Function
>
> I am familiar with Microsoft Knowledge Base Article
> 209996, but it does not do the trick.
>
> Any help is greatly appreciated.
>
> Lucky
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      15th Jun 2004
Have you tried FIX(9.99) which gives 9
 
Reply With Quote
 
Lucky
Guest
Posts: n/a
 
      15th Jun 2004
Thank you for your suggestion. Worked exactly as
advertised.

Lucky

>-----Original Message-----
>You might try using the built-in Int or Fix functions.

They would round
>down both 9.031 and 9.99949 to 9. They differ in how

they handle negative
>numbers. Int rounds (truncates) away from zero, and Fix

rounds (truncates)
>towards zero. For example:
>
>Int(-9.031) would return - 10
>
>where as
>
>Fix(-9.031) would return 9.
>
>
>
>"Lucky" <(E-Mail Removed)> wrote in

message
>news:1ca9c01c452d6$e7715620$(E-Mail Removed)...
>> I need to create an Access only Round Down function.
>> This function must round down every number. Therefore,
>> if the number is 9.031 or 9.99949 the result still must
>> be 9.
>>
>> I have been using Excel RoundDown function, but the
>> queries are becoming rather large and this function

slows
>> down the processing intolerably.
>>
>> Here is the function I have used:
>>
>> Function xlRoundDown(dblNumber As Double) As Long
>> 'Round number down using Excel RounDown function
>> Dim objExcel As Excel.Application
>>
>> Set objExcel = CreateObject("Excel.Application")
>> xlRoundDown = objExcel.Application.RoundDown
>> (dblNumber, 0)
>>
>> objExcel.Quit
>> Set objExcel = Nothing
>> End Function
>>
>> I am familiar with Microsoft Knowledge Base Article
>> 209996, but it does not do the trick.
>>
>> Any help is greatly appreciated.
>>
>> Lucky
>>

>
>
>.
>

 
Reply With Quote
 
Lucky
Guest
Posts: n/a
 
      15th Jun 2004
No and thank you for your suggestion. It does exactly
what I need.

Lucky

>-----Original Message-----
>Have you tried FIX(9.99) which gives 9
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Roundup or Ceiling Function to round to a specific number =?Utf-8?B?QW5naWUzMw==?= Microsoft Excel Misc 26 11th Sep 2008 04:29 PM
Access Round() Function Question =?Utf-8?B?SmFpX0ZyaWRheQ==?= Microsoft Access 5 1st Nov 2006 10:33 AM
Round Function in Access Brian Microsoft Access Queries 3 10th Dec 2003 07:46 AM
Does Access have Round Function? Anny Microsoft Access 5 4th Aug 2003 11:29 AM
Round() function in Access 97? Wei Microsoft Access 2 25th Jul 2003 05:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:35 PM.