+ Reply to Thread
Results 1 to 6 of 6

How to check if a time noted is within designated window or range in Excel

  1. #1
    Registered User
    Join Date
    02-11-2018
    Location
    US
    MS-Off Ver
    2003
    Posts
    3

    How to check if a time noted is within designated window or range in Excel

    I need to check if a time of collection is within allowed time window or not.

    For e.g.

    A B C
    1 2/1/2017 10.36 2/1/2017 10.30 1 min out of +/- 5 minutes window
    2 2/1/2017 10.24 2/1/2017 10.30 1 min out of +/- 5 minutes window

    A1 here time of collection of data (date included), and B1 is the scheduled time. The acceptable window or range for this is +/- 5 minutes. In this case the time of collection is 1 min out of +/- 5 minutes window. Similar example is shown in row 2. How can i get C1 to show the message or something similar as above which can account for + 5 minutes (after scheduled time- late) and - 5 minutes (before scheduled time-early) scenarios?.

    Thank you!.

  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,412

    Re: How to check if a time noted is within designated window or range in Excel

    Are those proper date and time values, or text values which look like date/times? The reason for asking is that times are normally shown separated by a colon ( : ), like 10:36, so the formula may be affected by this.


    Pete

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: How to check if a time noted is within designated window or range in Excel

    If the date and time in columns A and B are in fact date data types, you might be able to use something like this

    Please Login or Register  to view this content.
    The 0.0034722 should equate to 5 minutes usinge the date value.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Registered User
    Join Date
    02-11-2018
    Location
    US
    MS-Off Ver
    2003
    Posts
    3

    Re: How to check if a time noted is within designated window or range in Excel

    Can i get a solution in the form of a formula ?. So that i can show my team as well ?.

  5. #5
    Registered User
    Join Date
    02-11-2018
    Location
    US
    MS-Off Ver
    2003
    Posts
    3

    Re: How to check if a time noted is within designated window or range in Excel

    those are date and time columns merged together using "+" =date+time.

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

    Re: How to check if a time noted is within designated window or range in Excel

    You can put this formula in C1:

    =IF(ABS(A1-B1)>=TIME(0,5,0),TEXT(ABS(A1-B1)*24*60,"0")-5&" min out of +/- 5 minutes window","within window")

    then copy down.

    Hope this helps.

    Pete

+ 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. shell to search for a designated term in a designated folder
    By drech in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2016, 01:33 PM
  2. Save file so that next time it's opened Range A1 is active and in the window?
    By dmasters4919 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-18-2015, 11:27 AM
  3. [SOLVED] Receive a Run-time error '1004' when selecting a designated range of rows
    By blrunning in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2015, 08:52 AM
  4. Replies: 5
    Last Post: 05-07-2014, 07:35 AM
  5. Replies: 5
    Last Post: 08-14-2013, 11:08 AM
  6. Replies: 6
    Last Post: 11-28-2011, 04:08 AM
  7. Replies: 4
    Last Post: 02-17-2011, 08:29 AM

Tags for this Thread

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