How to use ceiling function in access

G

Guest

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
 
N

Nikos Yannacopoulos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top