+ Reply to Thread
Results 1 to 6 of 6

Sum days/hours between multiple dates in excel with criteria

  1. #1
    Registered User
    Join Date
    08-22-2019
    Location
    Manchester
    MS-Off Ver
    Office 365
    Posts
    3

    Sum days/hours between multiple dates in excel with criteria

    Hi there, my first post here and it's a bit of a complicated one! (at least for me). I've read everywhere and can't find an answer so any help would be really appreciated.

    I'm trying to generate a report that shows the number of days any item is out of stock. The data I use is as shown in the attached.

    As is, I use COUNTIF to count all the times any stock item is on zero, which is helpful, but it doesn't give me any indication of the amount of time it's been out of stock.

    What I want the formula to do is instead of returning the number of times out of stock, it sums the length of time from 0 to >0 which could happen multiple times in the data.

    Does anyone have any kind of starting point for me please?

    Thanks in advance

    Abe
    Attached Images Attached Images
    Last edited by Abe1992; 08-22-2019 at 05:07 PM.

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

    Re: Sum days/hours between multiple dates in excel with criteria

    Hello Abe1992 and Welcome to Excel Forum.
    It may help if you upload a fictionalized .xlsx file similar to the one from which the screen shot is taken.
    To upload a sample workbook click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window. Remember to include a few manually produced outcomes so that we will have a better idea of what you are looking for.
    Let us 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
    08-22-2019
    Location
    Manchester
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Sum days/hours between multiple dates in excel with criteria

    Hi there, thanks so much for getting back to me.

    I've attached a fictionalised sheet as it's currently calculated using countifs.

    I'd be really grateful for any guidance!

    Many thanks

    Abe
    Attached Files Attached Files

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

    Re: Sum days/hours between multiple dates in excel with criteria

    This proposal adds a helper column, which may be moved and/or hidden for aesthetic purposes, to Sheet2.
    The helper column (G) is populated using: =IFERROR(IF(INDEX(C3:C$4108,MATCH(A2,A3:A$4108,0))=0,INT(B2)-INT(INDEX(B3:B$4108,MATCH(A2,A3:A$4108,0))),""),"")
    The number of days out of stock is displayed in column F of Sheet1 using: =SUMIFS(Sheet2!G$2:G$4108,Sheet2!A$2:A$4108,B2)
    Let us know if you have any questions.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-22-2019
    Location
    Manchester
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Sum days/hours between multiple dates in excel with criteria

    Hi JeteMC, sorry for the slow response I've been away and not had a chance to test this out.

    I've just applied it to my data and it has worked perfectly, thank you so much for taking the time to help me!

    Many thanks

    Abe

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

    Re: Sum days/hours between multiple dates in excel with criteria

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed 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] Calculating Years, Months, Week, Days, Hours, Minutes for Work Days between two dates
    By hecgroups in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-23-2019, 12:09 AM
  2. [SOLVED] Total release and total login hours - excel formula, help!
    By dy137 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2017, 04:45 AM
  3. [SOLVED] Calculate Total Hours each occurrence and Total Days for all occurences
    By CARD17 in forum Excel Formulas & Functions
    Replies: 47
    Last Post: 01-18-2017, 11:02 PM
  4. [SOLVED] Subtracting Dates to Show Hours Spanning Multiple Days
    By andylee1892 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-04-2016, 01:43 PM
  5. [SOLVED] Subtract dates to give a total amount of days - Multiple Data
    By t_man000 in forum Excel General
    Replies: 2
    Last Post: 07-23-2015, 11:14 PM
  6. Formula to sum total working hours and convert into days
    By tariqnaz2005 in forum Excel General
    Replies: 1
    Last Post: 04-30-2015, 09:08 AM
  7. Converting Total Hours to Business Hours/Days
    By Fadooshy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-27-2015, 12:26 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