+ Reply to Thread
Results 1 to 6 of 6

Time Ranges

  1. #1
    Registered User
    Join Date
    11-06-2007
    Posts
    10

    Time Ranges

    Hello,

    My work sheet contains occurances that take place at certain times of the day. My spreadsheet contains 2000 rows. Each row is an occurance. Each occurance has a particular time stamp associated with the occurance.

    I'm attemtping to evaluate if the time of day falls into a time range. When I evaluate the time 07:31, this time would fall into the 0700-0800 time range. If the time was 09:31, it would fall into the 0900-1000 time range, etc. Consequently, I need to evaluate each specific time and return the range that this time would fall into.

    The time stamp is in column A and there are 2000 rows. I'd like to return the time range "0700-0800" or "0800-0900", or "0900 - 1000" etc in column F

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =TEXT(A2,"hh")&"00-"&TEXT(A2+"1:00"+0,"hh")&"00"

    where A2 houses timestamp
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    11-06-2007
    Posts
    10
    This worked. Thanks

    How would the formula change if it was simply a number range?

    Thanks

  4. #4
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    Quote Originally Posted by NBVC
    Try:

    =TEXT(A2,"hh")&"00-"&TEXT(A2+"1:00"+0,"hh")&"00"

    where A2 houses timestamp

    Excelent!

    Replying so I can have this one on my CP. I need to have a look at the text function.

    My solution included a formula that concatenated 24 different if statements...

    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  5. #5
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    Couldn't the formula be shortened to =TEXT(A2,"hh")&"00-"&TEXT(A2+1/24,"hh")&"00"?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by jmag
    This worked. Thanks

    How would the formula change if it was simply a number range?

    Thanks
    What exactly do you mean?

+ 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