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 7 to Access 2003 using Excel VBA
- Access access
- How can I call the function TotalPrice within another function?
- user defined functions
- help on functions
- Problems with XL's 'MATCH' function
- How to call a JNI function in C
- User defined functions not recognized
- custom Sum function?
- "Min 4" function?
- New MAX function?
- Populate Formula(Function) in rows
- defining variables in function
- help requested for using excel's built-in function in coding
- Linest Function
- Excel won't calculate my function
- User Function - is optional calculation possibe?
- Automatic update of Function return value.
- String-Split Function parameter "compare"
- function as argument