iff, then, else textbox help!!! revisited...

C

clawdogs

I need help merging the following IIF statements on a form. Both work
seperately but I need them to work together. Both are seperat IIF
statements without else. Else can be anything or zero etc...

=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)

=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])
 
R

RonaldoOneNil

Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first IIF

=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)
 
C

clawdogs

Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first IIF

=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)



I need help merging the following IIF statements on a form.  Both work
seperately but I need them to work together.  Both are seperat IIF
statements without else.  Else can be anything or zero etc...
=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)
=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])- Hide quoted text -

- Show quoted text -

That didn't work. Can someone help with maybe IIF THEN, IIF THEN,
ELSE?
 
B

BruceM

It's hard to believe they worked in their original form considering that the
expressions have different numbers of opening and closing parentheses.

It looks as if the responder copies the same thing for the Then and the
Else. It should be something like:

=IIf([NOVRATE]>1,

([CUMPERCENTOVNOV] - 1) *
[EMPLOYEE DATA subform].Form!TOVCOMP2 *
[NOVRATE] +
[EMPLOYEE DATA subform].Form!TOVCOMP2,

[NOVRATE] *
[EMPLOYEE DATA subform].Form!TOVCOMP2 *
[CUMPERCENTOVNOV])

The spaces and line breaks are for clarity only.

There is no need for parentheses around field names. Parentheses other than
those required for the IIf function (or other functions, if you had used
them) are for grouping data as needed to perform the calculations.

Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first IIF

=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)



I need help merging the following IIF statements on a form. Both work
seperately but I need them to work together. Both are seperat IIF
statements without else. Else can be anything or zero etc...
=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)
=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])- Hide quoted text -

- Show quoted text -

That didn't work. Can someone help with maybe IIF THEN, IIF THEN,
ELSE?
 
P

Piet Linden

Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first IIF
=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)
I need help merging the following IIF statements on a form.  Both work
seperately but I need them to work together.  Both are seperat IIF
statements without else.  Else can be anything or zero etc...
=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)
=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])- Hide quoted text -
- Show quoted text -

That didn't work.  Can someone help with maybe IIF THEN, IIF THEN,
ELSE?- Hide quoted text -
Sorry, the standard format for nesting is:
=IIF(Test,TrueResult,IIF(Test,TrueResult,FalseResult))
So, substituting ...

=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2),IIf
([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])))
 
B

BruceM

The OP never stated what would happen if NOVRATE is exactly 1, but allowing
for that possibility is the only reason I can see for nesting two IIf
statements. If it is just a matter of testing whether it is >1 or not, a
single IIf statement will suffice. The mismatched parentheses in the OP's
original expressions are surely part of the problem. From what I can tell
the first expression has five each opening and closing parentheses, but they
are not arranged in a way that seems to make sense. The second expression
doesn't even have the same number of each.

Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first
IIF
=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)
I need help merging the following IIF statements on a form. Both work
seperately but I need them to work together. Both are seperat IIF
statements without else. Else can be anything or zero etc...
=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)
=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])- Hide quoted text -
- Show quoted text -

That didn't work. Can someone help with maybe IIF THEN, IIF THEN,
ELSE?- Hide quoted text -
Sorry, the standard format for nesting is:
=IIF(Test,TrueResult,IIF(Test,TrueResult,FalseResult))
So, substituting ...

=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2),IIf
([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])))
 
C

clawdogs

It's hard to believe they worked in their original form considering that the
expressions have different numbers of opening and closing parentheses.

It looks as if the responder copies the same thing for the Then and the
Else.  It should be something like:

=IIf([NOVRATE]>1,

    ([CUMPERCENTOVNOV] - 1) *
    [EMPLOYEE DATA subform].Form!TOVCOMP2 *
    [NOVRATE] +
    [EMPLOYEE DATA subform].Form!TOVCOMP2,

    [NOVRATE] *
    [EMPLOYEE DATA subform].Form!TOVCOMP2 *
    [CUMPERCENTOVNOV])

The spaces and line breaks are for clarity only.

There is no need for parentheses around field names.  Parentheses otherthan
those required for the IIf function (or other functions, if you had used
them) are for grouping data as needed to perform the calculations.


Assuming NOVRATE is never 1, then the 2nd IIF is the else to the first IIF
=IIf([NOVRATE]>1,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA
subform].Form!TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA
subform].Form!TOVCOMP2,[CUMPERCENTOVNOV]-1*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2)
I need help merging the following IIF statements on a form. Both work
seperately but I need them to work together. Both are seperat IIF
statements without else. Else can be anything or zero etc...
=IIf([NOVRATE]>1,([CUMPERCENTOVNOV])-1)*([EMPLOYEE DATA subform].Form!
TOVCOMP2)*([NOVRATE])+([EMPLOYEE DATA subform].Form!TOVCOMP2)
=IIf([NOVRATE]<1,([NOVRATE])*([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([CUMPERCENTOVNOV])- Hide quoted text -
- Show quoted text -

That didn't work.  Can someone help with maybe IIF THEN, IIF THEN,
ELSE?- Hide quoted text -

- Show quoted text -

Thanks for clarifying... I used your example with spaces as the
following and it seems to work:

=IIf([NOVRATE]>1,([CUMPERCENTOVNOV] - 1)*[EMPLOYEE DATA subform].Form!
TOVCOMP2*[NOVRATE]+[EMPLOYEE DATA subform].Form!TOVCOMP2,[NOVRATE]*
[EMPLOYEE DATA subform].Form!TOVCOMP2*[CUMPERCENTOVNOV])
 

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