+ Reply to Thread
Results 1 to 21 of 21

Layered "If" statement.

  1. #1
    Registered User
    Join Date
    06-24-2005
    Posts
    21

    Layered "If" statement.

    I would like to know if someone could tell me how to do this.

    I have to check if a cell contains the letter M. If it does, then the word monday must be inserted into another cell. If it is not M, then it must check to see if it is a T for tuesday. This must continue, checking for w, th, and f.

    I have been trying something like this, but it doesnt work:

    {for, say L3}

    =if(H3=M,monday,(if(H3=T,tuesday,____________)))

    I skipped the ___________

    Help?

  2. #2
    Registered User
    Join Date
    10-02-2003
    Location
    Rhode Island
    Posts
    63

    ...

    Not that I'm a guru ... I'm just waiting for somone to help me with my question.

    But, it worked for me the way you were trying it. I expect you have your syntax messed up (extra parentheses around the IF, missing quotes, etc.?).

    Use the below as an example.

    =IF(D2="M","Monday",IF(D2="T","Tuesday",IF(D2="W","Wednesday",IF(D2="R","Thursday","Friday"))))

    Good luck!

  3. #3
    Registered User
    Join Date
    06-24-2005
    Posts
    21
    Wow, thank you so much. You are amazing! Now, I have one more even specific question. you have, say, =M. What I would need it to be is contains the phrase "T M", "T T", "T W", etc... This is part of a larger passage and there is a T and space before each of the M, T, W, Th, or F. So rather than have equal (=), how would I do contains? Thanks again.

    I may be out today, but I will be back on Monday. Thanks!

  4. #4
    Registered User
    Join Date
    10-02-2003
    Location
    Rhode Island
    Posts
    63

    ...

    If the format of the cell containing the letter is always the same, then you could use the MID function. For example, if the cell contained "T M", and you are looking at the M to designate Monday, then replace the D2 with:

    MID(D2,3,1)

    Note that spaces are counted so this formula is counting from the left 3 characters (T,space,M) and returing 1 character starting with the M ... i.e. just M.

    Look up the RIGHT, LEFT and MID functions. One of those should do the trick.

  5. #5
    Registered User
    Join Date
    10-02-2003
    Location
    Rhode Island
    Posts
    63

    ...

    one more thing ... note that if "Th" is your flag for Thursday, then the MID formula for the Thursday IF statement would need to return 2 characters vs 1 (i.e MID(D2,3,2))

  6. #6
    Registered User
    Join Date
    06-24-2005
    Posts
    21
    I dont understand. How would I edit

    =IF(D2="M","Monday",IF(D2="T","Tuesday",IF(D2="W","Wednesday",IF(D2="R","Thursday","Friday"))))

    so that the logical test part (the first one being D2="M") can be

    D2{contains}"T M"

    ?

    I want to replace D2="M" with D2{contains}"T M", but I just do not know how to notate this.

    Thank you so much though for your time.


  7. #7
    Registered User
    Join Date
    06-24-2005
    Posts
    21
    Anyone have any ideas at all?

  8. #8
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  9. #9
    Registered User
    Join Date
    06-24-2005
    Posts
    21
    Here is another idea that I had. How could I make a function that would return the vaule of the 6th space in another cell.

    {For, say D3}

    IF((space 6 of B3)="M","Monday",IF((space 6 of B3)="T","Tuesday",IF(_________)

    The part in red is what I dont know how to do (as you can see I am new to excel. I just skipped the _______ rather than type it all out.

    Thanks again for all your help.

  10. #10
    Registered User
    Join Date
    10-02-2003
    Location
    Rhode Island
    Posts
    63

    ...

    Look up the MID function in the help menu.

    To extract character 6 from a series of characters in D2, replace D2 with MID(D2, 6, 1).

    e.g.

    =IF(MID(D2, 6, 1)="M","Monday",IF(MID(D2, 6, 1)="T","Tuesday",IF(MID(D2, 6, 1)="W","Wednesday",IF(MID(D2, 6, 1)="R","Thursday",IF(MID(D2, 6, 1)="F",""Friday")))))

    Again note that this is using "R" for Thursday ... if you have "Th" taking up spots 6 and 7, then use:

    =IF(MID(D2, 6, 1)="M","Monday",IF(MID(D2, 6, 1)="T","Tuesday",IF(MID(D2, 6, 1)="W","Wednesday",IF(MID(D2, 6, 2)="Th","Thursday",IF(MID(D2, 6, 1)="F",""Friday")))))
    Last edited by William DeLeo; 06-27-2005 at 08:35 AM.

  11. #11
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  12. #12
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  13. #13
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  14. #14
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  15. #15
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  16. #16
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  17. #17
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  18. #18
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  19. #19
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  20. #20
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

  21. #21
    Dave Peterson
    Guest

    Re: Layered "If" statement.

    I'd create a small table on another worksheet.

    Put the abbreviations in column A and the long names in column B.

    =vlookup(a1,sheet2!a:b,2,false)

    to return the longer name.

    brookdale wrote:
    >
    > Anyone have any ideas at all?
    >
    > --
    > brookdale
    > ------------------------------------------------------------------------
    > brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
    > View this thread: http://www.excelforum.com/showthread...hreadid=382076


    --

    Dave Peterson

+ 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