iif statement

teiben

Registered User.
Local time
Today, 11:02
Joined
Jun 20, 2002
Messages
462
I'm trying to write the statement, if the awarded box is checked then sum the potential sales:

=IIF([Awarded]*-1),Sum([potentialSales]))

I've tried if a few different ways ~ HELP
 
Ok, how would you rewrite it so it works then
 
You only have the true part of the expression.

What do you want to happen if the check box is FALSE?

Pat's expression contains both parts and your expression must take the same form. Shouldn't that be [Awarded] =-1 by the way?


This expression will return 0 if the check box is blank or PotentialSales if it's checked.
 
I have tried this a few different ways, but shouldn't it work this way? awarded is a yes/no check box and potential sales is a textbox.
If awarded is checked -1 then sum the potential sales, otherwise display No Information.


Sum(IIF([Awarded]=-1, [potentialSales], 0, "No Information")
 
No, the syntax is

IIF(exp,truepart,false part). Only two commas.
This will return truepart if exp evaluates to true or false part if exp evaluates to false

So your expression should read

=SUM(IIF([Awarded]=true, [PotentialSales],0)

where the PotentialSales is the true part and 0 is the false part.

You also have to take note of the datatype. You can't store text in a field that's formatted for a number.
 
Last edited:
Your my hero! I didn't think I could use true / false in the checkmark fields, the -1 was confusing me more than I normally am.

Thanks a mILL
 

Users who are viewing this thread

Back
Top Bottom