Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Switch

Experts, I am trying to make a switch statement out of the below.   I get a wrong number of arguments.  The IIF statement works fine separately but I need to add the Nz part and I assume that Switch is the solution.  

=Switch(Nz([Gustav]=""),"0 after pmt",IIf([CurrencyID]=1,[Gustav],[Gustav]*[ExchangeRate]))

thank you
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is how Swich works:
Switch([CurrencyID]=1,[Gustav],[CurrencyID]=2,[Gustav]*[ExchangeRate])

Open in new window

It's basically like a one line Select Case statement.
Avatar of pdvsa

ASKER

Thank you  very much for your response.
Glad to help :)
or you could use it like:

=Switch(NZ(Gustav],"") = "", "O after pmt", [CurrencyID] = 1, [Gustav], True, [Gustav] * [ExchangeRage])

I always finish out my SWITCH( ) function calls with a final pair that includes a TRUE and a value to use if none of the other conditions are met.  This guarantees that if none of the original conditions are met, I will still get a value returned that I can filter on.