negative values in calculated results

  • Thread starter Thread starter Deb H
  • Start date Start date
D

Deb H

When using the Sum and IIf functions in an expression, I'm
getting negative values in my results. How can I change or
format this to show the correct positive values?
Example:
Sum((IIf([Field1]=yes,1,0)) and (IIf([Field2]=yes,1,0)))
Thanks for your help.
Deb
 
Its your formula.
Sum((IIf([Field1]=yes,1,0)) and (IIf([Field2]=yes,1,0)))

The And makes it compare the left and the right and will
return a true if they are equal or false if they are
different.

Depends on what you are hoping for:
If you want to return a 1 for each field that has a yes
then...
Sum((IIf([Field1]=yes,1,0)) + (IIf([Field2]=yes,1,0)))

if you want a 1 if both are yes then...
x: IIf([Field1]=Yes And [Field2]=Yes,1,0)

if you want a 1 if either are yes then...
x: IIf([Field1]=Yes or [Field2]=Yes,1,0)

-Cameron Sutherland
 
Back
Top