Try using == instead of = in your IIF statements.

For example,

IIF(templ = True

should be coded as

IIF(templ == True

David Jennings wrote:

I have a piece of code which seems straight forward but I seem to be struggling. i have written it in a number of different ways e.g. using if statements in a loop and using iif statements as below. However, I seem to have a problem which ever way I write it insofar that Test1L & Test1S fail to evaluate correctly. Herewith a snippet:
       t1 = XPermK - XpermD;

       inter2 = abs(XPermK - XpermD);

TempL = IIf (XpermD[j] >UpperBound *AND* XPermK[j] >UpperBound, *True*,*False*);

       Test1L = IIf(tempL = *True*  *AND* abs(t1) < 2, *True*, *False*);

Test2L= IIf(XpermD < Lowerbound *AND* XPermK < Lowerbound *AND* t1 > 2.0,*True*, *False*);

Test3L=IIf(XPermK >Lowerbound *AND* XPermK > XPermD,*True*,*False*);

Test1S = IIf(XpermD < Lowerbound *AND* XPermK < Lowerbound *AND* abs(t1) < 2,*True*,*False*);

Test2S = IIf(XpermD > UpperBound *AND* XPermK[k] > UpperBound *AND* t1> 2,*True*,*False*);

Test3S = IIf(XPermK < UpperBound *AND* XPermK < XPermD,*True*,*False*);

XPermLong = IIf(Test1L = *True* *OR* Test2L[j] = *True* *OR* Test3L[j] = *True*,*True*, *False*);

XpermShort =IIf(Test1S = *True* *OR* Test2S = *True* *OR* Test3S = *True*,*True*,*False*); For instance Test1l can return false and Test1L will evaluate as true. Most grateful if someone could help me understand why I have it around my neck.

Reply via email to