Please see the example data below:
Time Date Result
00:21.6 10/1/2012 1:43 FALSE
01:47.7 10/1/2012 2:13 FALSE
00:56.7 10/1/2012 2:49 FALSE
00:54.9 10/1/2012 3:43
00:11.8 10/1/2012 3:43
02:10.9 10/1/2012 3:46 FALSE
01:05.4 10/1/2012 3:58 FALSE
00:55.8 10/1/2012 4:53
04:41.8 10/1/2012 4:52
00:26.3 10/1/2012 4:58
00:04.2 10/1/2012 4:58
00:15.3 10/1/2012 4:59
00:06.4 10/1/2012 4:57
00:10.7 10/1/2012 4:56
00:04.4 10/1/2012 4:56
00:04.2 10/1/2012 4:57
00:29.2 10/1/2012 4:57
00:34.5 10/1/2012 4:56
01:22.4 10/1/2012 4:55
00:08.1 10/1/2012 4:55 FALSE
03:20.9 10/1/2012 4:51 FALSE
00:56.3 10/1/2012 5:42 FALSE
02:23.1 10/1/2012 5:51
01:20.6 10/1/2012 5:48
00:09.8 10/1/2012 5:49 FALSE
01:40.0 10/1/2012 7:47 FALSE
01:13.4 10/1/2012 8:11 FALSE
00:41.6 10/1/2012 9:49 FALSE
01:08.1 10/1/2012 11:56 FALSE
I need to perform a certain type of calculation. If there is no blank cell in the result, I need the data in time cell next to the result. But if there is a blank cell in the result column, I need to perform a sum of the time in the rows that contain the blank cell and the first cell containing FALSE next to the blank cell.
Please see the example output below:
00:21.6 10/1/2012 1:43 FALSE 00:21.6
01:47.7 10/1/2012 2:13 FALSE 01:47.7
00:56.7 10/1/2012 2:49 FALSE 00:56.7
00:54.9 10/1/2012 3:43
00:11.8 10/1/2012 3:43
02:10.9 10/1/2012 3:46 FALSE 03:17.6(i.e., 00:54.9+00:11.8+02:10.9)
01:05.4 10/1/2012 3:58 FALSE 01:05.4
00:55.8 10/1/2012 4:53
04:41.8 10/1/2012 4:52
00:26.3 10/1/2012 4:58
00:04.2 10/1/2012 4:58
00:15.3 10/1/2012 4:59
00:06.4 10/1/2012 4:57
00:10.7 10/1/2012 4:56
00:04.4 10/1/2012 4:56
00:04.2 10/1/2012 4:57
00:29.2 10/1/2012 4:57
00:34.5 10/1/2012 4:56
01:22.4 10/1/2012 4:55
00:08.1 10/1/2012 4:55 FALSE 09:23.3(i.e., 00:55.8+04:41.8+00:26.3+00:04.2+00:15.3+00:06.4+00:10.7+00:04.4+00:04.2+00:29.2+00:34.5+01:22.4+00:08.1)
03:20.9 10/1/2012 4:51 FALSE 03:20.9
00:56.3 10/1/2012 5:42 FALSE 00:56.3
02:23.1 10/1/2012 5:51
01:20.6 10/1/2012 5:48
00:09.8 10/1/2012 5:49 FALSE 03:53.5(i.e., 02:23.1+01:20.6+00:09.8)
01:40.0 10/1/2012 7:47 FALSE 01:40.0
01:13.4 10/1/2012 8:11 FALSE 01:13.4
00:41.6 10/1/2012 9:49 FALSE 00:41.6
01:08.1 10/1/2012 11:56 FALSE 01:08.1
If it is possible by any formulas or using visual basic editor please let me know. I am doing this manually right now. I have to handle about 10000-15000 rows per day. If you help me out I could save a lot of hours and use it to learn something new.
You can try this if you prefer using VBA:
I'm assuming your existing range starts in cell A1 (i.e. the word
"Time"
exists in cell A1). I am also assuming that in column C, the two possible values are the logical valueFALSE
(not the text string"FALSE"
), or blank (not a string of 1 or more spaces).In cell D1, enter the formula
=IF(AND(C2=FALSE,C1=""),D1+1,1)
In cell E1, enter the formula
=IF(C2="","",SUM(OFFSET(A2,-(D2-1),0,D2,1)))
Set the number format in cell E1 to
"mm:ss.0"
Copy D1 and E1 all the way down your range. Hide column D if desired.
Pretty easy in two columns. Calculate a running total and reset if the cell above is not blank.
E.g.
Copy those formulas on down
Assuming data starts at row 2 with headers in row 1 then you can use this formula in D2 copied down
=IF(C2<>"",SUM(A$2:A2)-SUM(D$1:D1),"")