+ Reply to Thread
Results 1 to 4 of 4

determine if timestamp in one column falls within a range (array) of other timestamps

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    determine if timestamp in one column falls within a range (array) of other timestamps

    I've attached a workbook with several columns. Column B is a list of timestamps. If column B's timestamp falls within any of the "blocked" time ranges shown in columns K and L, I want to note that with a formula in column D. (The formula simply says to write a "N" if column B falls within the "blocked" ranges)

    For example if cell B136 has a timestamp 2:25 on 1/15/19, and row 40 of columns K and L shows a time range of 2:00 to 4:00 on 1/15/19, this means we want to block row B136. We will do this with a formula in column D (which simply writes a "N" if row 136 is time-blocked).

    Any advice?

    Thanks so much!
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: determine if timestamp in one column falls within a range (array) of other timestamps

    Please try at D8

    =IF(SUMPRODUCT((--SUBSTITUTE(B8,".","-")>=$K$9:$K$155)*(--SUBSTITUTE(B8,".","-")<=$L$9:$L$155)),"N","")

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

    Re: determine if timestamp in one column falls within a range (array) of other timestamps

    I would probably build something based on the approximate match options for Excel's lookup functions. Here's how I did it:

    1) The time stamps in column B are text strings that my copy of Excel does not recognize as date/time serial numbers. The first thing I did was convert them to something my copy of Excel will recognize as date/time serial numbers
    1a) Select column B -> Find and Replace dialog -> Find "." -> Replace with "/" -> Replace All. Excel automatically makes the text replacement and converts to real date/time serial numbers.
    2) An approximate match lookup will find the row where the "start time" in column K is just less than the lookup value. I can use the result of this lookup to return the "end time" from column L. If this return value is greater than the lookup value, then I know that the lookup value is between the start and end time. I might formulate this as =IF(VLOOKUP(B8,$K$9:$L$155,2,TRUE)>B8,"N","not"). To deal with the N/A errors for those lookup values before the first time, I can nest that inside of an IFERROR() or IFNA() function.

    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.

  4. #4
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: determine if timestamp in one column falls within a range (array) of other timestamps

    Thanks Bo and MrShorty! Both ideas are good. I've used SUBSTITUTE before when dealing with the timestamp prob, which works. And the IFERROR also helps. Bo's formula seems to work properly though so I'm going to try it, and if I run into more probs I'll get back to you. I very much the help from both of 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. [SOLVED] Determine if a date falls between a range of two dates
    By hdabbas in forum Excel General
    Replies: 9
    Last Post: 07-12-2017, 12:01 PM
  2. Replies: 4
    Last Post: 05-08-2017, 09:32 PM
  3. Find Timestamp in a range of non-matching timestamps
    By kalffiend in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-10-2015, 11:56 AM
  4. [SOLVED] Determine if time range falls within the day, evening, or an in between period
    By Jstark1956 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-09-2014, 05:07 PM
  5. Replies: 4
    Last Post: 10-19-2013, 06:43 PM
  6. [SOLVED] Determine if a value falls within a horizontal and vertial range
    By td87280 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-31-2012, 05:13 PM
  7. Formula to determine whether number falls within range??
    By Cat in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-16-2005, 10:05 PM

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