+ Reply to Thread
Results 1 to 5 of 5

Converting a number to a time period HELP

  1. #1
    Registered User
    Join Date
    08-09-2006
    Posts
    5

    Converting a number to a time period HELP

    Thanks to this forum i discovered the LOOKUP function Now i need help in taking a number (1-11) and for a given number convert it to a time period.

    Example 1 = 8:00-4:00, 2 = 8:30-5:00

    I need to describe the whole range of periods 1-11. Does anybody have a function solution

    Thanks for the HELP

  2. #2
    Trevor Shuttleworth
    Guest

    Re: Converting a number to a time period HELP

    One way:

    =IF(AND(A1>=1,A1<=11),VLOOKUP(A1,{1,"08:00-16:00";2,"08:30-16:30";3,"09:00-17:00";4,"t1-t2";5,"t1-t2";6,"t1-t2";7,"t1-t2";8,"t1-t2";9,"t1-t2";10,"t1-t2";11,"t1-t2"},2,FALSE),"error")

    Regards

    Trevor


    "Bobsled" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks to this forum i discovered the LOOKUP function Now i need
    > help in taking a number (1-11) and for a given number convert it to a
    > time period.
    >
    > Example 1 = 8:00-4:00, 2 = 8:30-5:00
    >
    > I need to describe the whole range of periods 1-11. Does anybody have
    > a function solution
    >
    > Thanks for the HELP
    >
    >
    > --
    > Bobsled
    > ------------------------------------------------------------------------
    > Bobsled's Profile:
    > http://www.excelforum.com/member.php...o&userid=37303
    > View this thread: http://www.excelforum.com/showthread...hreadid=571832
    >




  3. #3
    Earl Kiosterud
    Guest

    Re: Converting a number to a time period HELP

    Bobsled,

    Since your numbers conveniently start at 1, and are consecutive, we can
    cheat a little, and use:

    =CHOOSE(A1,"08:00-16:00","8:30-17:00", ... )

    But this isn't considered good programming practice. It's error-prone, and
    if anything changes, someone has to wade into this formula and make changes.
    It will be someone else, since you will have long been promoted for your
    craftiness. Your legacy.

    A general way is to make a table:

    1 8:00-16:00
    2 8:30-17:00
    etc

    Then use VLOOKUP:

    =VLOOKUP(A1,Table,2,FALSE)

    Now if the data changes, the table simply needs to be updated.
    --
    Earl Kiosterud
    www.smokeylake.com
    -----------------------------------------------------------
    "Bobsled" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks to this forum i discovered the LOOKUP function Now i need
    > help in taking a number (1-11) and for a given number convert it to a
    > time period.
    >
    > Example 1 = 8:00-4:00, 2 = 8:30-5:00
    >
    > I need to describe the whole range of periods 1-11. Does anybody have
    > a function solution
    >
    > Thanks for the HELP
    >
    >
    > --
    > Bobsled
    > ------------------------------------------------------------------------
    > Bobsled's Profile:
    > http://www.excelforum.com/member.php...o&userid=37303
    > View this thread: http://www.excelforum.com/showthread...hreadid=571832
    >




  4. #4
    Registered User
    Join Date
    08-09-2006
    Posts
    5
    Thanks to the great folks on the forum I've got a good scheduling program working for my wife. Trevor the formula worked like a champ!

    Thanks

  5. #5
    Trevor Shuttleworth
    Guest

    Re: Converting a number to a time period HELP

    You're welcome. Thanks for the feedback. I trust your wife will be pleased
    with your efforts.


    "Bobsled" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks to the great folks on the forum I've got a good scheduling
    > program working for my wife. Trevor the formula worked like a champ!
    >
    >
    > Thanks
    >
    >
    > --
    > Bobsled
    > ------------------------------------------------------------------------
    > Bobsled's Profile:
    > http://www.excelforum.com/member.php...o&userid=37303
    > View this thread: http://www.excelforum.com/showthread...hreadid=571832
    >




+ 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