IIF Error Wrong Number of Arguments

jashe

New member
Local time
Today, 14:27
Joined
Oct 25, 2011
Messages
5
:confused:Good day, I am having trouble with an IIF statement. Can someone tell me if this is doable. I get an erro that says wrong number of arguments. What I am looking for is that when a Hospital is selected that factor is displayed for, for example if Methodist is select then 85.00 dollars is displayed. Not sure if OR operator is correct to use. Can someone help me please.

Hospital Factor: CCur(IIf([HospitalName]="Baptist Health Systems",98.00 Or [HospitalName]="Christus Santa",100.00 Or [HospitalName]="HCA",75.00 Or [HospitalName]="Methodist",85.00 Or [HospitalName]="University Health Systems",99.00))
 
Welcome to the forum.

To use the Or operator your structure should look like;
Code:
Iif([Test1] Or [test2] or [Test3], CondtionTrue, ConditionFalse)
However what you are trying to do is a cascading logical test so your argument should look like

Code:
CCur(IIf([HospitalName]="Baptist Health Systems", 98.00 Iif([HospitalName]="Christus Santa", 100.00,Iif([HospitalName]="HCA",75.00, Iif([HospitalName]="Methodist", 85.00, 99.00)))))
 
Last edited:
That is not the appropriate syntax; you'd nest multiple IIf() functions. Based on what you're doing, the Switch() function would be simpler. I'd probably have the data in a table to make it more dynamic.
 
Again I've got the slow fingers! I'm blaming the severe wind we're experiencing. :p
 
Top-o-the-morning! Almost lunch time here. Maybe hunger slowed me down...yeah, that's it!!
 
Lack of food does that to me too :)

Enjoy your lunch.

I guess it's Friday where you you are too, so perhaps your mind is starting to focus on your weekend :p
 
Thank you all I use John's and it worked perfectly.
 

Users who are viewing this thread

Back
Top Bottom