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 SkipVought 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
Sep 17, 2001
30
0
0
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)

 
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