+ Reply to Thread
Results 1 to 4 of 4

if statement for datetime value between two other datetime values

Hybrid View

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    Camarillo, Ca
    MS-Off Ver
    Microsoft for MAC 2011
    Posts
    10

    if statement for datetime value between two other datetime values

    Need help finding formula on where column D (unique value) falls between Column A (static value) and Column B (static value) and return Column C (static value) in Column E.
    A B C D E
    Start_DateTime End_DateTime SHIFT1 Date_Time
    1/1/15 7:00 1/2/15 6:59 C 1/1/15 0:06
    1/2/15 7:00 1/3/15 6:59 B 1/1/15 1:01
    1/3/15 7:00 1/4/15 6:59 C 1/1/15 1:01
    1/4/15 7:00 1/5/15 6:59 A 1/1/15 0:00
    1/5/15 7:00 1/6/15 6:59 C 1/1/15 0:02
    1/6/15 7:00 1/7/15 6:59 A 1/1/15 0:04
    1/7/15 7:00 1/8/15 6:59 B 1/1/15 0:09

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,759

    Re: if statement for datetime value between two other datetime values

    The following formula is going to produce blanks for all of the cells in column E because all of the date_times in column D are prior to the beginning of the first shift on 1/1/15 at 7:00 a.m. If you put in a date_time that is actually during a shift, that shifts code letter will be returned.
    =IF(SUMPRODUCT((A$2:A$8<=D2)*(B$2:B$8>=D2))=0,"",INDEX(C$2:C$8,SUMPRODUCT((A$2:A$8<=D2)*(B$2:B$8>=D2)*(ROW(A$2:A$8)-1))))
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    02-19-2015
    Location
    Camarillo, Ca
    MS-Off Ver
    Microsoft for MAC 2011
    Posts
    10

    Re: if statement for datetime value between two other datetime values

    JeteMc THANK YOU!! I never even thought of adding that first line of data...It came up blank every time. This works like a charm for my total response time QC project for the Fire Department. Thank you!

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,759

    Re: if statement for datetime value between two other datetime values

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread 'Solved' using the thread tools link above your first post. I hope that you have a good day.

+ 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] ISO datetime difference
    By NDBT85 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2014, 10:12 AM
  2. Replies: 4
    Last Post: 10-04-2013, 02:00 PM
  3. ISO 8601 datetime values not correctly loaded in EXCEL Sheet
    By jveirasv in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-17-2013, 09:47 AM
  4. formatting datetime, US vs. UK
    By kmfdm515 in forum Excel General
    Replies: 5
    Last Post: 05-05-2012, 03:16 AM
  5. Based on a Column datetime value auto calculate and populate a datetime range
    By rajashanmuga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2010, 04:10 PM
  6. Sort datetime values
    By s1joshi in forum Excel General
    Replies: 11
    Last Post: 02-01-2010, 11:15 PM
  7. datetime question
    By mr_P in forum Excel General
    Replies: 2
    Last Post: 07-16-2008, 01:56 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