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
- Access Recovery Software to Repair Corrupt MS Access database
- Excel Function
- VB function
- How to make VB6 function work in VBA
- Need Help for Macro to Perform Same Function Only on Certain Sheets
- GETTING CUSTOMER NAME FROM ANOTHER WORKBOOK THRU PUBLIC FUNCTION
- Perform a function based on a VLookup
- Len function help
- Worksheet functions in VBA
- Write a loop program with functions required
- Draw Approximate function in c++
- macro function
- VBA Excel Coding for dynamically changing function range
- apply function for range of column cells
- function
- loop, inheritence and function, class
- User Defined Functions for Financial Accounts
- Searching algorithm of strings with function pointers