Time Blocking and Count? (Formula help)

yessir

Board Regular
Joined
Jun 7, 2019
Messages
91
I am curious if there is formula that can help me get a different view of my data. Is there a way to measure the shifts time times from one date to another? For this

ABCD
LocationTime7/1/20156/1/2015
AAA10:101
AAA10:161
AAA13:531
AAA15:371
AAA16:251
AAA17:351
AAA21:351
AAA21:441
BBB14:031
BBB14:131

To then look like something like this?
It would look at the location in Column A and keep the time block if there was a value in the old date area and a value in the new date area and return that during an hour block starting at 10:00 they kept the 10:00.
And for example they lost their 16:00 one hour block. Hopefully that wasn't too confusing...

AAAKept 10:00
AAAKept 13:00
AAAKept 15:00
AAALost 16:00
AAAGained 17:00
AAAKept 21:00
BBBKept 14:00

I'm unsure about the format of it as well? But this is my best visualization. Anything helps! Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Trying to understand the logic here to help out...
If the hour (minutes irrelevant) occurs on both days, Kept Hour
If the hour was on previous day but not current day Lost Hour
If Hour is new, Gained Hour?
Wouldn't it be Gained 15:00 not Kept 15:00?
 
Upvote 0
You're absolutely right. An oversight on my part.

AAAKept 10:00
AAAKept 13:00
AAAGained 15:00
AAALost 16:00
AAAGained 17:00
AAAKept 21:00
BBBKept 14:00
 
Upvote 0
Ever have one of those days where you make something more complicated than necessary...
Here is the simpler version.

Columns F:H can be hidden but they are necessary feeders.

Book1
ABCDEFGHIJK
1
2LocationTime7/1/20156/1/2015
3AAA10:101 10 01AAAKept 10:00
4AAA10:161 10   AAAGained 13:00
5AAA13:531 13 12AAAGained 15:00
6AAA15:371 15 13AAALost 16:00
7AAA16:251 16 -14AAAGained 17:00
8AAA17:351 17 15AAAKept 21:00
9AAA21:351 21 06BBBKept 14:00
10AAA21:441 21     
11BBB14:031 14 07  
12BBB14:131 14     
Sheet1
Cell Formulas
RangeFormula
F3:F12F3=HOUR(B3)
G3:G12G3=IF(COUNTIFS($A$3:A3,A3,($F$3:F3),F3)=1,SUMIFS($C$3:$C$12,$A$3:$A$12,A3,$F$3:$F$12,F3)-SUMIFS($D$3:$D$12,$A$3:$A$12,A3,$F$3:$F$12,F3),"")
H3:H12H3=IF(G3<>"",1+MAX($H$2:H2),"")
J3:J12J3=IF(ROWS($J$3:J3)<=MAX(H:H),INDEX($A$3:$A$12,MATCH(ROWS($J$3:J3),$H$3:$H$12,0)),"")
K3:K12K3=IF(J3<>"",CHOOSE(INDEX($G$3:$G$12,MATCH(ROWS($J$3:J3),$H$3:$H$12,0))+2,"Lost ","Kept ","Gained ")&INDEX($F$3:$F$12,MATCH(ROWS($J$3:J3),$H$3:$H$12,0))&":00","")
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

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