Search: | |||||

| ||||

Home » Forum » MS Office | RSS Feeds |

One question in Access (2003).

I need to accomplish this "rounding" task in MS Access 2003

1) If it is 10.000001 it should be 11

2) If it is 10.999999 it should be 11 too.

In other words, I just need the exact functionality of the CEILING()

function thats available in MS Excel.

I tried Round(expr,significance). But that does not get me what I need.

Also a couple of other functions like int, Cint etc. But in vain. I

posted it in some websites seeking for an answer.

The result of this is important because it is used as one of the

operand in a multiplication operation. So if have 0.3, then i need 1

and not a 0.

: One question in Access (2003).

:

: I need to accomplish this "rounding" task in MS Access 2003

:

: 1) If it is 10.000001 it should be 11

: 2) If it is 10.999999 it should be 11 too.

:

: In other words, I just need the exact functionality of the CEILING()

: function thats available in MS Excel.

I am not familiar with the Access, but I have run into a similar

problem in computer languages which do not offer a ceiling function.

Try something like this. "int" is the integer function available in

most languages. (I didn't test this on negative numbers.)

' Ceiling

If number > int(number) Then number = int(number) + 1

I thing function INT() can help you.

**********

Dim b As Double

Dim i As Integer

b = 10.000001

i = Int(b)

If i = b Then

i = i +1

End If

*********

The simplest version I think would be:

Public function Ceiling(ByVal X As Double) As Double

Ceiling = Int(X) - (X - Int(X) > 0)

End Function

Watch out for negative numbers, as David Smart suggested. This function

would round them up.

Plenty of hits with a Google search. This one for instance ...

http://www.tek-tips.com/faqs.cfm?fid=5031

A lot depends on just how accurately you want to simulate Excel's Ceiling.

It takes two parameters, and they must both be of the same sign, and it

rounds away from zero (i.e. negative numbers become more negative).

Didn't find what you were looking for?
Find more on Ceiling Function in Access
Or get search suggestion and latest updates.

Related Topics:

- Accessing help file info for non-Excel 2007 functions from VBA
- Access Function In Another Sheet
- Wait function and Invisible function
- Wait function and Invisible function
- Add-Ins loaded into Excel
- Access access
- Access 7 to Access 2003 using Excel VBA
- about JSP reset function
- Math function to determine if a number is an int
- HttpContext.Current function returns Nothing for spawned thread
- date Function
- how Mysql database function java code execute ?
- MAPI Functions
- function that returns a String Array
- Why does Java not allow default function arguments ?
- Is there a way or method to implement different function of applet
- Call JavaScript function from JAva Code
- can somebody please explain the function of "this"
- where should i include function
- Call C function through Java
- Column Headings using getColumnName function
- how to make alphabets uppercase without using function
- Destroy function inservlet
- How to call a JNI function in C
- User defined functions not recognized