+ Reply to Thread
Results 1 to 12 of 12

If Time is Within Range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    If Time is Within Range

    Looking for formula to look into column D and column E to return "In Range" if Time is within range and Out of Range if Time of not within range using the Time Range Condition in J1 and K1. See attached sample file.

    Desired Outcome is in column F.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: If Time is Within Range

    You can use this formula in cell F2:

    =IF(E2<D2,"Out of Range","In Range")

    then copy down as required. It gives different results from your sample file on rows 94 and 113, so just check those again.

    Hope this helps.

    Pete

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: If Time is Within Range

    @Pete: don't you need to check against J1 and K1?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: If Time is Within Range

    Well, the range is from 0:00:00 to 23:59:00 which is virtually a complete day, so I presumed the OP wanted to check for times which wrap around midnight, based on the formula in column G, and the range becomes irrelevant.

    Pete

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: If Time is Within Range

    maybe

    Formula: copy to clipboard
    =IF(E2-D2<0,"out of range",IF(OR(0<=E2-D2,E2-D2<=$K$1-$J$1),"in range",))
    Last edited by sandy666; 01-07-2023 at 09:49 PM.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: If Time is Within Range

    Ok. I was just wondering about …
    … using the Time Range Condition in J1 and K1.
    But, fair enough, you might not need it. I couldn't get my head round it anyway.

  7. #7
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,178

    Re: If Time is Within Range

    Another option:

    =IF(AND(A2+D2>=A2+$J$1,G2+E2<=A2+$K$1),"In Range","Out of Range")

    This assumes that your "time range" is for the same day. You can change your Time Range to any time frame and it should still work. You do have some records though where your Sales Time IN is later than your Sales Time OUT for the same day, which doesn't make sense to me (row 94 for example).

  8. #8
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    Re: If Time is Within Range

    Gregb11: Row 94 and 113 were erroneously entered as In Range instead of Out of Range. Thanks for the rep, Gregb11.

  9. #9
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,178

    Re: If Time is Within Range

    Isn't the TIME erroneously entered, not whether it was in or out of range? How can you have your OUT time before your In time on the same day (or is the OUT DATE erroneously entered)?

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    Re: If Time is Within Range

    Gregb11 : Time was not erroneously entered. The sales rep started her shift at 7:20PM on 12/19/2022 and finished on 12/20/2022 at 7:30AM. Thus, Out of Range.

    Thanks

  11. #11
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,178

    Re: If Time is Within Range

    "(or is the OUT DATE erroneously entered)?"
    Then this is true

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: If Time is Within Range

    bj.... go back and look at Post 2. Did you see it? I'm pretty certain it's what you want. I think you're overcomplicating things....
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

+ 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: 2
    Last Post: 06-26-2018, 09:10 PM
  2. [SOLVED] Check if range of time falls in another range of time
    By wafs in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-18-2018, 06:47 PM
  3. Formula to substract a range of time from a range of time
    By nabeel.rehman in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 05-22-2017, 01:14 PM
  4. [SOLVED] COUNTIF Time Range - Time Range provided in Cells
    By Eaks77 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-02-2015, 11:12 PM
  5. [SOLVED] Counting values in a time range - when the time range crosses midnight
    By dlocos in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-24-2014, 04:27 AM
  6. Calculate if Time range appears in an other Time range
    By bajdr47 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-25-2013, 02:50 AM
  7. compare time values - current time with time in cell range?
    By wyattea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2013, 11:28 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