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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF Statements

Status
Not open for further replies.

DanSc0tt

MIS
Joined
Sep 17, 2001
Messages
30
Location
DE
This should be really simple, but just not working!!

I have three text boxes 1,2 & 3 - I want to calculate a value in three based on 1 & 2, but return "0" if either of 1 or 2 are "0". So i tried

IIF([1] or [2] = 0,0,([2]-[1])/[1])

it doesn't work

am i doing something silly???

Dan
 
Here you go - this one also checks for null values:

=IIf(nz([1])<>0,IIf(nz([2])<>0,([2]-[1])/[1],0),0)

 
IIF(([1] = 0 or [2] = 0),0,([2]-[1])/[1])
 
Try this

IIF([1]= 0,0,IIF([2]=0,0,([2]-[1])/[1])))

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top