If a value is negative how to make it equal 0

M

Marc

If I do a calculation between two fields and the answer ends up to be
negative how do I make the negative number equal 0.
 
R

Rick Brandt

Marc said:
If I do a calculation between two fields and the answer ends up to be
negative how do I make the negative number equal 0.

=IIf(YourCurrentExpression < 0, 0, YourCurrentExpression)
 
M

Marc

=IIF([Finished Date Man BR by QA]-[Packaging Date]<0,0 [Finished Date Man BR
by QA]-[Packaging Date])

Is above how I'm suppose to write it? It give me an error "you may have
entered a comma without a preceeding value identifier" Thanks for your help.
 
K

Klatuu

You are just missing a comma. The construct for an IIf statement is
IIf(condition, True Value, False Value)

=IIF([Finished Date Man BR by QA]-[Packaging Date]<0, 0, [Finished Date Man
BR
by QA]-[Packaging Date])


Marc said:
=IIF([Finished Date Man BR by QA]-[Packaging Date]<0,0 [Finished Date Man BR
by QA]-[Packaging Date])

Is above how I'm suppose to write it? It give me an error "you may have
entered a comma without a preceeding value identifier" Thanks for your help.

Rick Brandt said:
=IIf(YourCurrentExpression < 0, 0, YourCurrentExpression)
 
Top