Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with an "IF" formula

Status
Not open for further replies.

rb3625

Technical User
Oct 23, 2003
2
US
I have a field named "code" with drop-down choices of "active" or "inactive". I also have date fields for "date down" and "Picked up". I need the total number of days out-of-service calulated and entered in the field named "days o/s". Obviously I need to calculate from the "date down" to today's date as long as the record is "active". However, when "code" becomes "inactive", i need to stop the clock and calculate from the "date down" to "picked up". If someone has the formula for this, please advise.
 
I'd recommend setting a default value of active or inactive for the code field. Then new records won't have a null value and it's one less thing to test for in the formula.

I would use two calc fields to make it more readable; DaysOut1 will display the result. In the formula '' are two apostrophes to return null.

DaysOut1
If(IsBlank("date down") or IsBlank("picked up"), '', DaysOut2)

DaysOut2
If(code = 'active', Today() - "date down" , "picked up" - "date down")



Paul Bent
Northwind IT Systems
 
Thanks to Paulbent, formula works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top