+ Reply to Thread
Results 1 to 5 of 5

Multiple substitute question.

  1. #1
    Registered User
    Join Date
    03-31-2010
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Multiple substitute question.


    Hello, I am quite new to Excel but I have come across a complicated problem (at least for me it is complicated).

    I am trying to create a worsheet that automates codes for television file IDs. I have been successful in automating these with the exception of one cell. The cell that I need to formulate should be able to substitute a day (Monday, Tuesday, Wednesday...) that eminates from a cell in a different row with a number (1 to 7). Example: IF cell E1 has "Thursday", then L1 is "4". I am able to already do this with a SUBSTITUTE formula, However, the originating DAY cell is derived from another cell that contains a date.

    My problem occurs since the DAY cell is random. I have tried in vein to create the argument =SUBSTITUTE(E1,"Monday","1",1) plus =SUBSTITUTE(E1,"Tuesday","2",1) plus =SUBSTITUTE(E1,"Wednesday","3",1) all the way thru plus =SUBSTITUTE(E1,"Sunday","7",1)

    Is this at all possible or is my syntax just wrong (obviously it is wrong)

    I would really appreciate any help.

    Thanks in advance.
    Last edited by luxgap; 03-31-2010 at 04:10 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Multiple substitute question.

    Hi and welcome to the board

    why not use the WEEKDAY function ?
    You should have the analysis toolpak installed for it to work.
    Go to Tools - Addins - Check analysis toolpak ok

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Multiple substitute question.

    Perhaps, if I've understood, use a table / lookup based solution

    L1: =VLOOKUP(E1,{"Monday",1;"Tuesday",2;"Wednesday",3;"Thursday",4;"Friday",5;"Saturday",6;"Sunday",7},2,0)

    (in the above the table is stored via an inline array rather than in a range)

    EDIT: missed the "...the originating DAY cell is derived from another cell that contains a date" - above therefore unwarranted.
    Last edited by DonkeyOte; 03-31-2010 at 03:33 AM.

  4. #4
    Registered User
    Join Date
    03-31-2010
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Thumbs up Re: Multiple substitute question.

    The weekday function did it! Thank you so much, Arthurbr. Now my worksheet is flawless!

  5. #5
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Multiple substitute question.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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