Nested IIF statements

D

dascooper

I have a series of nested IIF statements that I cannot get to work. It
returns an error having the wrong number of arguments. I've spent quite a
bit of time and cannot resolve the problem. Any help would be much
appreciated. Here is the statement...

ratebase_date: IIf([formula_rate]=True, IIf([rate_case-date]<[project isd],
iif([(month([project isd])>6, dateserial(year([project isd])+1,6,1),
DateSerial(Year([project
isd]),6,1)),[rate_case-date]),IIf([rate_case-date]<[project
isd],DateSerial(Year([project isd]),6,1),[rate_case-date]))

In short, if the project isd is after the rate_case-date, it sets toe
ratebase date to either 6/1/ of the year in service if done before 7/1, else
it adds 1 to the year.
 
D

Dale Fye

When I run into this, I like to copy the IIF( ) to Wordpad and reformat it,
so that each parameter lines up (like below). When you do this, you can
easily see that in line three, you have an extra "[" that you need to get rid
of

ratebase_date: IIf([formula_rate]=True,
IIf([rate_case-date]<[project isd],
iif([(month([project isd])>6,
Dateserial(year([project isd])+1,6,1),
DateSerial(Year([project isd]),6,1)
),
[rate_case-date]
),
IIf([rate_case-date]<[project isd],
DateSerial(Year([project isd]),6,1),
[rate_case-date]
)
)

HTH
Dale
 
D

dascooper

Thanks! I was focusing on the brackets around the field names, ignoring any
stray ones. That fix, with removing an extra ( resolved the problem).

Dale Fye said:
When I run into this, I like to copy the IIF( ) to Wordpad and reformat it,
so that each parameter lines up (like below). When you do this, you can
easily see that in line three, you have an extra "[" that you need to get rid
of

ratebase_date: IIf([formula_rate]=True,
IIf([rate_case-date]<[project isd],
iif([(month([project isd])>6,
Dateserial(year([project isd])+1,6,1),
DateSerial(Year([project isd]),6,1)
),
[rate_case-date]
),
IIf([rate_case-date]<[project isd],
DateSerial(Year([project isd]),6,1),
[rate_case-date]
)
)

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.


dascooper said:
I have a series of nested IIF statements that I cannot get to work. It
returns an error having the wrong number of arguments. I've spent quite a
bit of time and cannot resolve the problem. Any help would be much
appreciated. Here is the statement...

ratebase_date: IIf([formula_rate]=True, IIf([rate_case-date]<[project isd],
iif([(month([project isd])>6, dateserial(year([project isd])+1,6,1),
DateSerial(Year([project
isd]),6,1)),[rate_case-date]),IIf([rate_case-date]<[project
isd],DateSerial(Year([project isd]),6,1),[rate_case-date]))

In short, if the project isd is after the rate_case-date, it sets toe
ratebase date to either 6/1/ of the year in service if done before 7/1, else
it adds 1 to the year.
 

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

Top