View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default nested IF without repeating the condition to be tested

wrote:
On Monday, 5 March 2012 18:35:20 UTC+1, joeu2004 wrote:
=CHOOSE(expression,result1,result2,result3,result4 )


thanks but I dont see how this would solve my problem.


Well, if you totally mispresent the problem in the first place, I cannot be
expected to provide solutions that apply to you.


Originally, you wrote:
example:
IF(condition=1;true;(if(condition=2;true;(if(condi tion=3;true;
.... and so on
is there a way to bring "condition" outside?


I answered that very question.

First, I replaced the word "condition" with the word "expression" because
the __condition__ is "something=1", "something=2", etc.

Then I wrote: "__if__ you are sure that "condition" (expression) will equal
only 1 through 4, you can write:
=CHOOSE(expression,result1,result2,result3,result4 )".

CHOOSE solves the problem __if__ "condition" (expression) returns 1 through
4. It does not require any other "nested IF".

The only problem was: you misrpresented the problem. GIGO.


Later, you wrote:
IF('somethingLong'=A;sumTHIS;if('somethingLong'=AA ;sumThat;
('somethingLong'=AAA;sumThose;sumthese)))
I am looking for a way to avoid writing 'somethingLong' 3 times.


Of course CHOOSE does not solve __that__ problem. It is a completely
different problem.

But even this new description is misleading and wrong. Perhaps you mean
something="A" and something="AA" -- quoted strings.

But then again, perhaps that's not what you mean at all. Who the hell
knows?!

I, for one, am tired of trying to second guess the real problem you are
trying to solve. It is a waste of time, yours as well as mine.

Good luck!