INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Calculation question - how to round the answer up

 Forum Search FAQs Links MVPs

## Calculation question - how to round the answer up

(OP)
I have a calculation field of: field1/500. That calculation field is working; however, the answer has to round up.
Example: $4,235,623.00/500=$8471.246 The answer of \$8471.246 has to round UP to the next whole number. I tried making the answer 0 decimal points but it then follows the .50> up, .49< rounds down. I thought it may have to be written as a javascript, but I'm not sure how to do that. Anyone have any ideas? Your input would be appreciated. Thanks!

### RE: Calculation question - how to round the answer up

Hi there,

the "Ceiling" function is your friend:

#### CODE

Math.ceil(8471.246)
will give you 8472.

Will that do?

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.

### RE: Calculation question - how to round the answer up

(OP)
Thank you! So how would I write that in my Field1/500 calculation?

### RE: Calculation question - how to round the answer up

To be honest, I do not have experience with caluclation fields.
However one of the following should work:
In properties, change calculation to "user-defined calculation script", enter

#### CODE

Ceil(Eval(form1.field1)/500)

FormCalc is different to Javascript.
In Javascript you could also add a Javascript action to the Lost Focus or Mouse out event of field1:

#### CODE

this.getField("yourcalculationfield").Value=Math.Ceil(this.getField("field1").Value;

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.

### RE: Calculation question - how to round the answer up

(OP)
I will try those. Thank you very much for your quick and detailed responses. They are appreciated!

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!