Duration (Time Difference) between 2 date fields in different rows

bannianke

New Member
Joined
Aug 25, 2020
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
I highly appreciate a helpful tip how to calculate the Status Duration of example provided below :

Scenario:

A case with a case number can have different case path statuses :
  • Open
  • Taken into account
  • Updated by Customer / BU : PoS
  • Customer waiting
  • Reopened
  • Closed
  • Point of Sales waiting

Every time the Case Path gets changed from "Old Value" to "New Value" a record for this change is presented in the raw data.
So I have for 1 case several records.
The download is sorting the records by "Edit" date oldest to newest but not in combination with the Case Number .... it looks at all cases and sorts only the Edit date.

I need to show how long the case was in each Status.
The Edit Date would reference the Date when the Status changed from the old to New Value
So I need to Compare 2 Edit Dates sitting in different rows to get the time duration
In addition the first reference DAte for status "Open" is always the Date when the Case was Created"

For Example :
case 4970052 stayed in Status "Open" for 5 Days before it changed to Status "Taken into account" ... in this status the case stayed for 1 Day... in Status "Customer Waiting" the duration was 3 days , in status "Updated by Customer / BU : PoS" for 5 days etc.

Which formula would work to show the duration for each status ?
Thanks a lot for your assistance !
Much appreciate it

bye
Anke

Case NumberCase Created DateField / EventEdit DateStatus - Old ValueStatus - New ValueStatus Duration
496749029/08/2023Case Path29/08/2023 12:04OpenTaken into account
496749029/08/2023Case Path29/08/2023 12:22Taken into accountUpdated by Customer / BU : PoS
496749029/08/2023Case Path29/08/2023 16:03Updated by Customer / BU : PoSClosed
497005225/08/23Case Path30/08/2023 16:51OpenTaken into account5 days
497005229/08/2023Case Path31/08/2023 17:35Taken into accountCustomer waiting1 day
497005229/08/2023Case Path03/09/23 11:12Customer waitingUpdated by Customer / BU : PoS3 days
498410704/09/2023Case Path04/09/2023 16:08OpenTaken into account
498410704/09/2023Case Path04/09/2023 16:38Taken into accountClosed
497005229/08/2023Case Path08/09/2023 16:21Updated by Customer / BU : PoSPoint of Sales waiting5 days
497005229/08/2023Case Path18/09/2023 17:18Point of Sales waitingUpdated by Customer / BU : PoS10 days
497005229/08/2023Case Path19/09/2023 09:47Updated by Customer / BU : PoSPoint of Sales waiting1 day
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi there,

Assuming your data starts in A1, the Sheet name is Sheet1, and that the "Open" status is the first one for each case, then, try the following formula in G2:

Excel Formula:
=IF(Sheet1!$E2="Open",INT(Sheet1!$D2-Sheet1!$B2),INT(Sheet1!$D2)-INT(LOOKUP(2,1/(Sheet1!$A2=$A$1:A1),$D$1:D1)))&" day(s)"

Copy down.
 
Upvote 0
Hi Leo, Perfect ...that was exactly what I was looking for.
Tried your suggested formula and it works like a dream !!!
Thanks again
bye
Anke
 
Upvote 0
Glad to help!!

Please, mark the post as solution.

 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top