If Function

PR2AledE

Registered User.
Local time
Today, 21:24
Joined
Mar 21, 2003
Messages
16
I'm trying to write an equation in one of the fields in query which will automatically change minus values into a text displaying loss and any positive values into text displaying win.

Any help will be greatly appreciated.
 
IIf(Sgn([YourField]) = -1,"Loss", "Win")
 
And if it's a 0 value - that's hardly a loss or a win so you could add the extra part:

IIf(Sgn([YourField]) = -1, "Loss", IIf(Sgn([YourField]) = 1, "Win", "No Change"))
 
Kind of Works

It does work but it asks me to enter the score. When I type Ok without typing anything the function works. Is there any way I can get rid of the command asking me to enter the score?
 
I'm guessing that Score is another calculated field?

If so, you might have two build this query off another query that gives you the score already calculated.

Unless someone knows another way...
 
Back to the IIf function

If the value is neither a minus or a postive as you said is it possible in this sutuations to dertermine if its a win or a loss from working out another calculated value.
 
Yes. Replace the [YourField] part with the calculation instead.

It would just need restructuring, maybe, to suit your needs.


IIf(Sgn([ActualScoreCalculation]) = -1,"Loss", "Win")
 
In a "No change sutuation" sutuation

If it is a "No Change" sutuation is it possible to dertermine whether it is a "win" or "loss" on another value. For example if another value in another field is a minus then the "No Change" value is a "loss" again" and visa-versa for a positive. But if it is neither a positive or a minus then the value is returned as "No Change" once again.
 

Users who are viewing this thread

Back
Top Bottom