+ Reply to Thread
Results 1 to 7 of 7

Help with calculating time difference using two criteria fields

  1. #1
    Registered User
    Join Date
    02-12-2023
    Location
    Philadelphia, PA
    MS-Off Ver
    Ver 2301 Excel Office 365
    Posts
    3

    Help with calculating time difference using two criteria fields

    I have data regarding the response of units to a particular incident based on their "status change", I.E. Dispatched, Arrived, Transport, Available, and need to calculate Response time (Dispatch to arrive), and Total time (Dispatch to Available).

    I am trying to calculate the time difference in a spreadsheet based on two sets of criteria. I have a field named Event# which has multiple entries depending on a Unit ID (which will also have multiple entries) and then a Unit Status.

    The first criteria needs to evaluate Event# to compare only those Event #'s that are the same, and the second needs to evaluate Unit ID to then compare only Unit ID's are the same within that particular Event # (there can be multiple units for one Event #). I am looking to determine the time difference between two entries where the Date/Time field represents a particular Unit Status change.

    My issue is how to do this in one or more steps.

    Spreadsheet for help.xlsx
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,489

    Re: Help with calculating time difference using two criteria fields

    Is this what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    02-12-2023
    Location
    Philadelphia, PA
    MS-Off Ver
    Ver 2301 Excel Office 365
    Posts
    3

    Re: Help with calculating time difference using two criteria fields

    Quote Originally Posted by TMS View Post
    Is this what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    It does work for total time (Dispatched to Available) but what about an intermediate time such as time from Dispatched to Arrived.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,489

    Re: Help with calculating time difference using two criteria fields

    Maybe this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-12-2023
    Location
    Philadelphia, PA
    MS-Off Ver
    Ver 2301 Excel Office 365
    Posts
    3

    Re: Help with calculating time difference using two criteria fields

    Quote Originally Posted by TMS View Post
    Maybe this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That works great except for times that transition over midnight. Ugh. I am also getting an occasional #SPILL! error.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,489

    Re: Help with calculating time difference using two criteria fields

    Try this to cope with times over midnight:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note: this is the "lazy" way using full column references. It could ( WILL ) be slow if used extensively. You should use specific ranges dependent on your data.
    Attached Files Attached Files

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,489

    Re: Help with calculating time difference using two criteria fields

    I suspect the SPILL implies there are more than one entry for some of the statuses.

+ 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] Calulating Time Difference from separate Date and Time fields
    By bsrivatsa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2022, 09:25 PM
  2. Calculate time difference between Date/Time fields
    By mattfleet in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-09-2019, 06:43 PM
  3. Replies: 3
    Last Post: 08-12-2017, 01:48 AM
  4. Calculating time difference
    By dwalters in forum Excel General
    Replies: 1
    Last Post: 01-11-2017, 09:39 AM
  5. Time difference between two Date Time fields.
    By sajit4134 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 07-19-2014, 03:21 AM
  6. Calculating time difference
    By TomBP in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-02-2010, 04:59 AM
  7. Calculating time difference between two days capturing the overnight time.
    By Monica_La in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-08-2007, 11:22 AM

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