+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Using IF, OR and TIMEVALUE to get a number for specific Time Range

  1. #1
    Registered User
    Join Date
    10-13-2009
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Using IF, OR and TIMEVALUE to get a number for specific Time Range

    I have a column (C) with various time stamps in the format HH:MM:SS ie. 00:24:58 and 10:35:43.

    I want to put in a number in Column D that returns a value between 1-8 depending on in which of the following time ranges the time stamp falls into:

    00:00:00 to 02:59:59 should return 1 in column D
    00:03:00 to 05:59:59 should return 2 " "
    00:06:00 to 08:59:59 should return 3 " "
    00:09:00 to 11:59:59 should return 4 " "
    00:12:00 to 14:59:59 should return 5 " "
    00:15:00 to 17:59:59 should return 6 " "
    00:18:00 to 20:59:59 should return 7 " "
    00:21:00 to 23:59:59 should return 8 " "

    I think I have to use =IF(OR(Bxx<=TIMEVALUE("00:00:00") up against =TIMEVALUE("03:00:00"));1) or something similar, but I can't for the life of me get it to work no matter what I try...

    Any input is highly appreciated..

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

    Re: Using IF, OR and TIMEVALUE to get a number for specific Time Range

    Welcome to the Board.

    Perhaps

    D1: =1+(FLOOR(C1;"03:00")/"03:00")
    copied down

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

    Re: Using IF, OR and TIMEVALUE to get a number for specific Time Range

    In hindsight that's a little more complex than need be...

    D1: =MATCH(HOUR(C1);{0\3\6\9\12\15\18\21})
    copied down

  4. #4
    Registered User
    Join Date
    10-13-2009
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Using IF, OR and TIMEVALUE to get a number for specific Time Range

    Fantastic! thanks!

    And in one line..great..

    if I wanted to have the actual time range returned (00-03,03-06,06-09,09-12 etc) returned instead, what can I do then?

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

    Re: Using IF, OR and TIMEVALUE to get a number for specific Time Range

    Sure.

    Please Login or Register  to view this content.
    but of course the return range values overlap

  6. #6
    Registered User
    Join Date
    10-13-2009
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Using IF, OR and TIMEVALUE to get a number for specific Time Range

    Perfect thanks!! that did the job!

+ 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