+ Reply to Thread
Results 1 to 7 of 7

IF function question?, not sure

  1. #1
    Registered User
    Join Date
    11-22-2006
    Posts
    5

    IF function question?, not sure

    Hi, first timer,

    I have column A named "Department" and cell A1=1 ,A2= 2, A3=3.
    I want to have another cell thats reads

    if A1 reads 1 then type the word "boy"
    if A2 reads 2 then type the word "girl"
    if A3 reads 3 then type the word "baby"

    can someone show me the correct syntax?
    Than you in advance..tony

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474
    have you considered a dropdown menu in A1

    select A1
    got data,validation
    from the allow box select list
    in the source box enter
    boy,girl,baby

    now you have a dropdown menu in A1

    then you could just reference A1,
    in cell D1 enter this =A1, now select an item from your dropdown menu



    As for your question
    is it possible that A1=boy and A2 =girl at the same time?

  3. #3
    Registered User
    Join Date
    11-22-2006
    Posts
    5
    Quote Originally Posted by davesexcel
    have you considered a dropdown menu in A1

    select A1
    got data,validation
    from the allow box select list
    in the source box enter
    boy,girl,baby

    now you have a dropdown menu in A1

    then you could just reference A1,
    in cell D1 enter this =A1, now select an item from your dropdown menu



    As for your question
    is it possible that A1=boy and A2 =girl at the same time?
    I actually want the condition to be printed on another column, sorry for the messy wordings...want it to look something like this...

    Column A is "Department"
    cell A1=1
    cell A2=2
    cell A3=3

    I actually want row B1 to type "boy" if A1 reads "1" like
    cell A1=1 cell B1 would show the word "boy"
    cell A2=2 cell B2 would show the word "girl"
    cell A3=3 cell B3 would show the word "baby"
    cell A4=2 cell B4 would show the word "girl" again

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474
    Quote Originally Posted by Tony Mach
    I actually want the condition to be printed on another column, sorry for the messy wordings...want it to look something like this...

    Column A is "Department"
    cell A1=1
    cell A2=2
    cell A3=3

    I actually want row B1 to type "boy" if A1 reads "1" like
    cell A1=1 cell B1 would show the word "boy"
    cell A2=2 cell B2 would show the word "girl"
    cell A3=3 cell B3 would show the word "baby"
    cell A4=2 cell B4 would show the word "girl" again
    sure
    B1=if(A1=1,"boy","")
    B2=if(A2=2,"girl","")
    ect

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by Tony Mach
    Hi, first timer,

    I have column A named "Department" and cell A1=1 ,A2= 2, A3=3.
    I want to have another cell thats reads

    if A1 reads 1 then type the word "boy"
    if A2 reads 2 then type the word "girl"
    if A3 reads 3 then type the word "baby"

    can someone show me the correct syntax?
    Than you in advance..tony
    Try this:
    =CHOOSE(A1,"boy","girl","baby")

  6. #6
    Registered User
    Join Date
    11-22-2006
    Posts
    5

    THANX a BUNCH

    Thanx a bunch u guys, I actually tried this and it works,

    =LOOKUP(A21,{1,2,3,4},{"Girl","Boy","Baby","Adult"})

    its a tedous if u have a lot of choices but it works too. this sit eiis great, beat draggin the text book around. Tony

  7. #7
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Tony Mach
    Thanx a bunch u guys, I actually tried this and it works,

    =LOOKUP(A21,{1,2,3,4},{"Girl","Boy","Baby","Adult"})

    its a tedous if u have a lot of choices but it works too. this sit eiis great, beat draggin the text book around. Tony
    Hi,

    If you word your formula as:

    =VLOOKUP(A21,{1,"Girl";2,"Boy";3,"Baby";4,"Adult"},2,FALSE)

    you will avoid the answer 'Adult' for numbers greater than 4, and

    =IF(ISNA(VLOOKUP(A21,{1,"Girl";2,"Boy";3,"Baby";4,"Adult"},2,FALSE)),"Unknown",VLOOKUP(A21,{1,"Girl";2,"Boy";3,"Baby";4,"Adult"},2,FALSE))

    will avoid the dreaded #N/A

    ---
    Si fractum non sit, noli id reficere.

+ 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