Calculation....need to drop the decimals in the result.

Carol Frangipane

Registered User.
Local time
Today, 08:30
Joined
Jul 11, 2007
Messages
19
Here's what I have so far...and it works fine; however, some results have decimal places; i.e., 2.1666666.

I just need the result to be the whole number. I can't seem to get it to come out that way...I've used "round"...but I must not be putting it in the right part of the formula.

TEST: IIf(Year([EndTerm])>Year(Date()),0,IIf((Year(Date())-Year([EndTerm]))/[Renew]<1,1,(Year(Date())-Year([EndTerm]))/[Renew]))


Thank you for any help!
Carol
 
The problem is that something is trapping time part of the date/time data type and that will probably case headaches somewhere else down the line but for the time being you can just wrap it all in an int() function:

int(IIf(Year([EndTerm])>Year(Date()),0,IIf((Year(Date())-Year([EndTerm]))/[Renew]<1,1,(Year(Date())-Year([EndTerm]))/[Renew])))
 
To use Round, you'd put your whole calculation in the first argument. You could also use the Int() or Fix() functions, depending on your needs.
 

Users who are viewing this thread

Back
Top Bottom