+ Reply to Thread
Results 1 to 5 of 5

To many Ifs

  1. #1
    Registered User
    Join Date
    02-09-2005
    Posts
    4

    Question To many Ifs

    I am trying to make an If Statement but I think its too long.
    Lets say
    A2:A22 is a list of name
    J3 returns a number between 1 - 20
    If J3=1 then A1=A2
    If J3=2 then A1=A3
    If J3=3 the A1=A4
    and so on. But I can't make an IF statement that looks for all 20. Any suggestions?

    This is my IF statement at the moment.
    =IF(J3=1,A3,IF(J3=2,A4,IF(J3=3,A5,IF(J3=4,A6,IF(J3=5,A7,IF(J3=6,A8,IF(J3=6,A9,IF(J3=7,A9,))))))))

    Thanks for any help
    Last edited by Abazaba; 02-10-2005 at 08:37 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    =OFFSET(A1,J3,0,1,1)

    in cell a1
    not a professional, just trying to assist.....

  3. #3
    Forum Contributor
    Join Date
    09-05-2004
    Location
    Melbourne
    Posts
    193
    Try using the INDEX function.

    =INDEX(A2:A22,J3)

    Cheers!

  4. #4
    Registered User
    Join Date
    02-09-2005
    Posts
    4
    I tried Duane's offset and it was returning the name 1 below the right name.

    so I tried the index fuction and it seems to be working right. Thanks so much!
    This is makeing my job easier!

  5. #5
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    glad you got the right answer but your post was misleading

    If J3=1 then A1=A2
    If J3=2 then A1=A3
    If J3=3 the A1=A4
    and so on. But I can't make an IF statement that looks for all 20. Any suggestions?

    This is my IF statement at the moment.
    =IF(J3=1,A3,IF(J3=2,A4,IF(J3=3,A5,IF(J3=4,A6,IF(J3 =5,A7,IF(J3=6,A8,IF(J3=6,A9,IF(J3=7,A9,))))))))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1