Need Help based on the given scenario

kriszpm

New Member
Joined
Dec 19, 2018
Messages
6
Hi,

I need to prepare a output based on the below table:

[TABLE="class: grid, width: 417"]
<tbody>[TR]
[TD]USER_ID[/TD]
[TD="align: center"]Type[/TD]
[TD="align: right"]Time Stamp[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 19:53[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 19:53[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 19:57[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-19-2018 18:30[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-19-2018 18:31[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-19-2018 18:32[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-19-2018 18:33[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"]Dec-19-2018 18:35[/TD]
[/TR]
[TR]
[TD]User_2[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 17:36[/TD]
[/TR]
[TR]
[TD]User_2[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 17:37[/TD]
[/TR]
[TR]
[TD]User_2[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-12-2018 19:12[/TD]
[/TR]
[TR]
[TD]User_2[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"]Dec-12-2018 19:15[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-13-2018 0:47[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-13-2018 0:47[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-13-2018 0:48[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-18-2018 2:22[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-15-2018 14:01[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-15-2018 14:01[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-15-2018 14:01[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-15-2018 14:02[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-31-2018 0:55[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-31-2018 0:55[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"]Dec-31-2018 0:55[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]Dec-31-2018 0:59[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"]Dec-31-2018 2:30[/TD]
[/TR]
</tbody>[/TABLE]

Basically, I need the Time Difference from the 1st Type-0 and 1st Type-1 for the specific User.
And then if the user has multiple Type-1s, another record should be there the Time Stamp of Type-0 should be next one to the earlier Type-1 TimeStamp.

Below is the out of above table:

[TABLE="class: grid, width: 578"]
<tbody>[TR]
[TD]UserID[/TD]
[TD="align: center"]Time Stamp of Type 0[/TD]
[TD="align: center"]Time Stamp of Type 1[/TD]
[TD="align: center"]Time Difference[/TD]
[/TR]
[TR]
[TD]User_1[/TD]
[TD="align: center"]Dec-12-2018 19:53[/TD]
[TD="align: center"]Dec-19-2018 18:35[/TD]
[TD="align: center"]6 days 22 hrs 41 mins[/TD]
[/TR]
[TR]
[TD]User_2[/TD]
[TD="align: center"]Dec-12-2018 17:36[/TD]
[TD="align: center"]Dec-12-2018 19:15[/TD]
[TD="align: center"]0 days 1 hrs 38 mins[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]Dec-13-2018 0:47[/TD]
[TD="align: center"]Dec-31-2018 0:55[/TD]
[TD="align: center"]18 days 0 hrs 7 mins[/TD]
[/TR]
[TR]
[TD]User_3[/TD]
[TD="align: center"]Dec-31-2018 2:59[/TD]
[TD="align: center"]Dec-31-2018 8:30[/TD]
[TD="align: center"]0 days 5 hrs 31 mins[/TD]
[/TR]
</tbody>[/TABLE]



Thanks in advance.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi Kriszpm,
are you looking for formulas, VBA code or something else? Please post your efforts so far.
Cheers,
Koen
 
Upvote 0
Hi Kriszpm,
you forgot to post the code you already wrote yourself (see my signature).
Thanks,
Koen
 
Upvote 0

Forum statistics

Threads
1,223,445
Messages
6,172,182
Members
452,447
Latest member
willsing5130

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