Thread: if statement
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default if statement

Hi Bryan
Excel has a limit of 7 nested functions. For this kind of formula I
would suggest you use VLOOKUP. Try the following:
- create a separate sheet with a lookup table (lets call this sheet
'lookup) and the following layout:
A B
1 AUCAD AS
2 EURJPY EJ
....

noy on your toher sheet use the following formula
=IF(ISNA(VLOOKUP(P2,'lookup'!$A$1:$B$20,2,0),"",VL OOKUP(P2,'lookup'!$A$
1:$B$20,2,0))



--
Regards
Frank Kabel
Frankfurt, Germany

Bryan wrote:
is there a limit on how many possibilities you can have in
an if statement.

i'm trying to write a statement like this.

=IF(P2="AUDCAD","AS",IF(P2="EURJPY","EJ",IF
(P2="EURGBP","GB",IF(P2="EURAUD","RA",IF
(P2="EURCHF","RZ",IF(P2="GBPJPY","SY",IF
(P2="AUDUSD","AD",IF(P2="GBPUSD","BP","")))))))

and this works fine, but when i try to add more if's i get
an this formula contains and error messege. for example if
i add one more case at the end for "CADUSD", i get an
error, but it works fine up to "GBPUSD"

=IF(P2="AUDCAD","AS",IF(P2="EURJPY","EJ",IF
(P2="EURGBP","GB",IF(P2="EURAUD","RA",IF
(P2="EURCHF","RZ",IF(P2="GBPJPY","SY",IF
(P2="AUDUSD","AD",IF(P2="GBPUSD","BP",IF
(P2="CADUSD","C1","")))))))))