PC Review Forums Newsgroups Microsoft Access Microsoft Access Getting Started How to use ceiling function in access

Reply

How to use ceiling function in access

 
Thread Tools Rate Thread
Old 15-04-2004, 07:51 AM   #1
=?Utf-8?B?U3VyZXNo?=
Guest
 
Posts: n/a
Default How to use ceiling function in access


Hi,

I have a problem using ceiling function in acces

for the given values i have to change them into multiples of
in excel its possible by using =ceiling($D1,6) where D1 is the say 1 and the result is
Before ceiling after ceilin
0 =
1 =
7 = 1
13 = 1

please help how to get that
  Reply With Quote
Old 15-04-2004, 12:21 PM   #2
Nikos Yannacopoulos
Guest
 
Posts: n/a
Default Re: How to use ceiling function in access

Suresh,

To be honest I wasn't aware of this function in Excel either, and from what
you say chances are it doesn't exist at all in Access, but it's very easy to
add it a user-defined one!
In the database window, go to Modules and add a new module, and paste the
following code in it:

Function ceiling(arg1, arg2)
arg2 = 6
intpart = Int(arg1 / arg2)
If arg1 Mod arg2 <> 0 Then
decpart = 1
Else
decpart = 0
End If
ceiling = (intpart + decpart) * arg2
End Function

Save. Now you can call your ceiling function from anywhere in the database,
with the same syntax as in Excel.

HTH,
Nikos

"Suresh" <anonymous@discussions.microsoft.com> wrote in message
news:8878624B-72CD-4BF4-B7D8-6C73AAEAD57A@microsoft.com...
> Hi,
>
> I have a problem using ceiling function in access
>
> for the given values i have to change them into multiples of 6
> in excel its possible by using =ceiling($D1,6) where D1 is the say 1 and

the result is 6
> Before ceiling after ceiling
> 0 = 0
> 1 = 6
> 7 = 12
> 13 = 18
>
> please help how to get that



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off