+ Reply to Thread
Results 1 to 7 of 7

Count If Start Datetime and End Datetime is less than 30 seconds

  1. #1
    Registered User
    Join Date
    11-27-2011
    Location
    UAE
    MS-Off Ver
    Excel 2007
    Posts
    6

    Count If Start Datetime and End Datetime is less than 30 seconds

    I need help in getting a count if the difference between a start and end datetime range is less than 15 minutes.
    Column A1:A100 contains the start datetime, e.g. 1/23/2017 12:26
    Column B1:B100 contains the end datetime, e.g. 1/23/2017 13:26

    Idea is countif B1:B100-A1:100 < 15 mins.

    Sample data attached
    Attached Files Attached Files
    Last edited by crappygeezer; 08-23-2017 at 06:22 AM.

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,938

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Registered User
    Join Date
    11-27-2011
    Location
    UAE
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    Thanks Shukla. Sample data attached in the original post.
    Last edited by crappygeezer; 08-23-2017 at 06:24 AM.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    g2=SUMPRODUCT(($C$2:$C$25>0)*($C$2:$C$25<=$B$2:$B$25+TIME(0,15,0))*($A$2:$A$25="Project"))
    g3=SUMPRODUCT(($C$2:$C$25>0)*($C$2:$C$25<=$B$2:$B$25+TIME(0,15,0))*($A$2:$A$25="Research"))
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,938

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    Or Try

    G2=SUM(1*(IF($A$2:$A$25="Project",(IF(ISBLANK($C$2:$C$25),10^10,$C$2:$C$25)-$B$2:$B$25)*60*60*24,"")<=900))
    G3=SUM(1*(IF($A$2:$A$25="Research",(IF(ISBLANK($C$2:$C$25),10^10,$C$2:$C$25)-$B$2:$B$25)*60*60*24,"")<=900))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  6. #6
    Registered User
    Join Date
    11-27-2011
    Location
    UAE
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    Quote Originally Posted by nflsales View Post
    g2=SUMPRODUCT(($C$2:$C$25>0)*($C$2:$C$25<=$B$2:$B$25+TIME(0,15,0))*($A$2:$A$25="Project"))
    g3=SUMPRODUCT(($C$2:$C$25>0)*($C$2:$C$25<=$B$2:$B$25+TIME(0,15,0))*($A$2:$A$25="Research"))
    This works! Thank you very much

  7. #7
    Registered User
    Join Date
    11-27-2011
    Location
    UAE
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Count If Start Datetime and End Datetime is less than 30 seconds

    Quote Originally Posted by shukla.ankur281190 View Post
    Or Try

    G2=SUM(1*(IF($A$2:$A$25="Project",(IF(ISBLANK($C$2:$C$25),10^10,$C$2:$C$25)-$B$2:$B$25)*60*60*24,"")<=900))
    G3=SUM(1*(IF($A$2:$A$25="Research",(IF(ISBLANK($C$2:$C$25),10^10,$C$2:$C$25)-$B$2:$B$25)*60*60*24,"")<=900))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    I will explore this as well. Thank 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] Move all files in a folder to a new folder it datetime less the latest datetime
    By capson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2016, 10:31 AM
  2. if statement for datetime value between two other datetime values
    By OSepulvedaIII in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2016, 10:37 AM
  3. [SOLVED] Removing Seconds from Datetime stamp
    By mangesh in forum Excel General
    Replies: 2
    Last Post: 07-04-2014, 03:19 AM
  4. Replies: 4
    Last Post: 09-25-2013, 04:00 PM
  5. Determining if a datetime falls within start and end date times
    By migooz in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-25-2013, 03:05 PM
  6. 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
  7. Stacked Chart with start Datetime and duration
    By maks71 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-19-2009, 02:16 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