Is the number of arguments in a function limited?

G

Guest

I am using an IIf function containing nested arguments and seem to run into a
problem when the number of arguments in the nest exceeds 5. Is there a limit
to the number of arguments than can be nested within an IIf function?
 
G

Guest

I don't know if there is a limit to the number of nested IIfs; however,
unless you are using nested IIfs for a query or writing SQL, then I would
suggest you use either If...Then..Else or Select Case instead. Nested IIfs
are hard to read. Also, note that both sides (True side, and False side) are
both evaluated before the function makes a selection. This makes it easy to
create an error or get unexpected results.
 
J

John Spencer

If I recall correctly you can't next IIF functions more than 7 deep. I know
there is a limit, but I'm not sure if I got the number correct.

Have you considered using the SWITCH function or writing a custom function
in VBA to handle this? I find nested IIF (beyond 2) difficult to edit so I
tend to avoid them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top