Results 1 to 8 of 8
Thread: If Statement (2003)

20080905, 02:56 #1
 Join Date
 Jan 2001
 Posts
 1,119
 Thanks
 0
 Thanked 0 Times in 0 Posts
If Statement (2003)
How do you set up a multiple If statement in Excel. I will have 5 Ifs. If(A2=0,"A", if(A2=1,"B",if(A2=2,"C",IF(A2=3,"D",If(A2=4,"E"))) )). This doesn't seem to work. I even tried If(A2=0,"A", if(A2=1,"B",if(A2=2,"C",IF(A2=3,"D","E")))) but no luck. Thanks for your help.
If the nested if doesn't work, how would I set up a Lookup. I tried =B1+Lookup(A1,{"A","B","C","D","E";0,1,2,3,4})
I am not sure what the correct syntax for this is. The data is in say Column A and I want the results in Column B. I tried this and everything results in 0.

20080905, 03:01 #2
 Join Date
 Aug 2004
 Posts
 123
 Thanks
 0
 Thanked 1 Time in 1 Post
Re: If Statement (2003)
This 2 formula can work for me, Do your entered " = " In front of the formula, as show below :
=IF(A2=0,"A", IF(A2=1,"B",IF(A2=2,"C",IF(A2=3,"D","E"))))
=IF(A2=0,"A", IF(A2=1,"B",IF(A2=2,"C",IF(A2=3,"D",IF(A2=4,"E"))) ))
The other option, you can use CHOOSE instead of IF, because CHOOSE accepted 29 arguments, something like :
=CHOOSE(A2+1,"A","B","C","D","E")
Regards
Bosco

20080905, 03:22 #3
 Join Date
 Jan 2001
 Posts
 1,119
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: If Statement (2003)
Those formulas work. I am not sure why they didn't work when I tried them the first time  probably just something I typed wrong.
I do have a question about Choose  I tried that but it only worked if the numbers in column 1 were in order. The 0,1,2,3,4 could be in any order.

20080905, 03:38 #4
 Join Date
 Aug 2004
 Posts
 123
 Thanks
 0
 Thanked 1 Time in 1 Post
Re: If Statement (2003)
Can you post some examples, together with your expected result.
Regards
Bosco

20080905, 04:20 #5
 Join Date
 Aug 2004
 Location
 Connecticut, USA
 Posts
 816
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: If Statement (2003)
You could use th following as well:
=CHAR(A2+65)

20080905, 05:42 #6
 Join Date
 Jan 2001
 Posts
 1,119
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: If Statement (2003)
Why doesn't this work =LOOKUP(A1,{"a",0;"b",1;"c",2;"d",4}). In Column A I have numbers 0,1,2,3,4 for say a 1000 records. Numbers are not in any order. In column B I put the Lookup formula but it gives me an N/A error. I looked this up and the example uses a text field where I have A1  "a". Can't I specify a variable  whatever is in column A?

20080905, 07:44 #7
 Join Date
 Jul 2002
 Location
 Pittsburgh, Pennsylvania, USA
 Posts
 11,225
 Thanks
 14
 Thanked 342 Times in 335 Posts
Re: If Statement (2003)
Because you are looking up numbers in the letters column. Try this array (confirm with ctrlshiftenter)
=LOOKUP(A1,{0,"a";1,"b";2,"c";4,"d"})
Steve

20080905, 08:09 #8
 Join Date
 Jan 2001
 Posts
 1,119
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: If Statement (2003)
Duh  Thanks. I thought you would put what you wanted first and then the number that represents what you have in column A. I guess not. Thanks for your help.