many IF conditions

  • Thread starter Thread starter 3Suk
  • Start date Start date
3

3Suk

Dear all,
in other scripts, I can write below, is there a simpler way instead of writing a long nested IF statement?

Select
when A=1 then do X;
when A=2 then do Y;
when A=3 then do Z;
when A=4 then do end.

Thanks in advance
PL.
 
hi PL,

Select Case A
Case A = 1: X
Case A = 2: Y
Case A = 3: Z
Case A = 4: _end
Case Else:another thing
End Select

isabelle

Le 2013-01-31 20:08, 3Suk a écrit :
 
there is also other possibilities, depending on what is X, Y, Z END.

isabelle


Le 2013-01-31 20:32, isabelle a écrit :
 
Dear all,

in other scripts, I can write below, is there a simpler way instead of writing a long nested IF statement?



Select

when A=1 then do X;

when A=2 then do Y;

when A=3 then do Z;

when A=4 then do end.



Thanks in advance

PL.

Isabelle,
I suppose your provide below is a macro. Since I don't know writing macro, is there a way in using formula?

Thanks,
Patrick
 
hi Patrick,

it is not possible, a formula can detects the cell value change, but
many formulas are in the same change at the same time.
here's a good way to start with vba!

isabelle

Le 2013-02-01 01:23, 3Suk a écrit :
 
depending on what is X, Y, Z END.
maybe you can use the formula
=CHOOSE(2,"X","Y","Z","END")

isabelle

Le 2013-02-01 02:31, isabelle a écrit :
 
Hi Patrick,

Am Thu, 31 Jan 2013 22:23:25 -0800 (PST) schrieb 3Suk:
I suppose your provide below is a macro. Since I don't know writing macro, is there a way in using formula?

any other value than 1, 2 or 3 will give you "End":
=IFERROR(CHOOSE(A1,"X","Y","Z"),"End")


Regards
Claus Busch
 
Hi Patrick,



Am Thu, 31 Jan 2013 22:23:25 -0800 (PST) schrieb 3Suk:






any other value than 1, 2 or 3 will give you "End":

=IFERROR(CHOOSE(A1,"X","Y","Z"),"End")





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

dear Claus, Isabelle,
sorry, I may mislead you, X, Y and Z are other formula, e.g. X is sum(J2:K2).

Patrick.
 
Back
Top