+ Reply to Thread
Results 1 to 7 of 7

Formula for: Does a time fall bewteen two cells (24 hour clock)

  1. #1
    Registered User
    Join Date
    10-26-2020
    Location
    California
    MS-Off Ver
    California , USA
    Posts
    3

    Formula for: Does a time fall bewteen two cells (24 hour clock)

    Hey all,

    I am in need of some help:

    I have a cell for Arrival Time (A1) and a Cell for Depart Time (B1).
    I also have a cell that has a specific time such as 1:00 or 2:00, etc (C1).

    I am in need of a formula that will tell me if C1 falls within A1 and B1.

    This is a 24 hour business so some times will cross midnight such as Arrival time of 23:00 and Depart time of 2:00

    Is this doable?

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    Hi

    How to know time on C1 belong to which day? For example, Arrival time of 13:00 (today), Depart time of 2:00 (tomorrow) and C1 is 14:00. So, how to know C1 is today or tomorrow?

  3. #3
    Registered User
    Join Date
    10-26-2020
    Location
    California
    MS-Off Ver
    California , USA
    Posts
    3

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    I would want to know if 1:00 or 2:00, etc falls between two different times. The arrival and depart COULD be on different days but not necessarily

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,397

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    Quote Originally Posted by Crablouse View Post
    I would want to know if 1:00 or 2:00, etc falls between two different times. The arrival and depart COULD be on different days but not necessarily
    OK, Let try:

    =IF(A1<B1,IF(OR(C1<=A1,C1>=B1),"Yes","No"),IF(AND(C1<=A1,C1>=B2),"Yes","No"))
    Quang PT

  6. #6
    Registered User
    Join Date
    10-26-2020
    Location
    California
    MS-Off Ver
    California , USA
    Posts
    3

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    Quote Originally Posted by bebo021999 View Post
    OK, Let try:

    =IF(A1<B1,IF(OR(C1<=A1,C1>=B1),"Yes","No"),IF(AND(C1<=A1,C1>=B2),"Yes","No"))
    Hey Bebo,

    I couldn't get that to work for me.

    I have attached a cleaned up version of what I am trying to do

    Column A: When the customer arrives (Date and Time)
    Column B: When the customer arrives (just Time)
    Column C: When the customer leaves (Date and Time)
    Column D: When the customer leaves (just Time)

    Column E: Result of - was the customer in the department at 1:00 am?
    Column F: Result of - was the customer in the department at 2:00 am?
    Column F: Result of - was the customer in the department at 3:00 am?
    etc
    etc
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,850

    Re: Formula for: Does a time fall bewteen two cells (24 hour clock)

    Since columns A and C contain both date and time information, it would be a simple "between" function, if I had a way to get date and time information from row 1. Here's what I did.

    1) Helper columns to get date+time for comparison. In J2, I enter =INT($A2)+TIME(1,0,0) [Note that I am assuming that, because all your other times are 24 hour clock, I am assuming your 1:00 to 5:00 are AM]. (The table automatically fills to the bottom and converts to structured table references). Copy across, replacing TIME(1,0,0) with TIME(2,0,0), TIME(3,0,0), etc.
    2) Now my formula for column E is =AND($A2<=J2,J2<=$C2). Copy into columns F:I. This gives me a TRUE when the time is between and FALSE when not.

    I'm sure that someone could nest the two functions together, but I did not bother at this point. Will something like that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 07-17-2017, 12:44 PM
  2. [SOLVED] Need formula to select cells that falls bewteen certain time
    By rv02 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-17-2015, 09:56 AM
  3. [SOLVED] Split Shift & Time Managment Grid based on 24 hour clock in 15 min increments
    By paxile2k in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-18-2013, 08:23 PM
  4. [SOLVED] Calculating time on site from a 24 hour clock
    By jatacake in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 03-11-2013, 06:36 AM
  5. Default time from 12 hour clock to 24 hour clock
    By MR-77 in forum Excel General
    Replies: 3
    Last Post: 03-31-2011, 04:15 PM
  6. Replies: 3
    Last Post: 09-29-2007, 04:58 PM

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