I have an output from an old system that lists hundreds of pages. These are grouped by dates. Since it's an old system, it dumps the output and I import into excel all in column A.
I want to count how many instances of something is between each date range.
So my source is: Note the date Tue Sep 10 08:52:40 2019 is date report run and not needed.
Call Date: 08/01/2019
6:47 0:01:04 35905 34312
7:19 0:04:50 33365 34312
7:16 0:12:58 36050 34312
7:45 0:16:06 33206 34312
8:52 0:17:48 33649 34312
9:35 0:02:38 33160 34312
9:29 0:10:10 32735 34312
9:43 0:00:12 34311 34312
9:40 0:04:16 33008 34312
10:19 0:09:18 33805 34312
10:25 0:06:00 32735 34312
Tue Sep 10 08:52:40 2019 Location: Page 2
Call Date: 08/01/2019 (cont.)
7:19 0:04:50 33365 34312
7:16 0:12:58 36050 34312
7:45 0:16:06 33206 34312
8:52 0:17:48 33649 34312
9:35 0:02:38 33160 34312
9:29 0:10:10 32735 34312
9:43 0:00:12 34311 34312
9:40 0:04:16 33008 34312
10:19 0:09:18 33805 34312
10:25 0:06:00 32735 34312
Tue Sep 10 08:52:40 2019 Location: Page 3
Call Date: 08/03/2019
7:21 0:02:40 37332 34312
7:46 0:00:38 32075 34312
7:49 0:08:02 37606 34312
8:52 0:02:24 33420 34312
8:58 0:01:40 33519 34312
8:59 0:02:20 36039 34312
9:13 0:00:42 35956 34312
9:09 0:04:58 32891 34312
9:19 0:00:18 35338 34312
9:24 0:01:44 33546 34312
Tue Sep 10 08:52:40 2019 Location: Page 4
I think the logic is set two variables startRow and endRow with startRow = "Call Date:" and endRow = "Location:"
Then using a foreach next loop, loop through each range between the startRow and endRow and countif contains ":"
The problem I have is how do I first find the start of the range and end of a range, but that range can reoccur many times. So was thinking a For Each Next loop??
````vba
Set lastRow = .Cells.Find("Location:", .Cells(1, 1), xlValues, xlPart, , xlPrevious)
Set firstRow = .Cells.Find("Call Date:", .Cells(1, 1), xlValues, xlPart, , xlPrevious)
For Each dateRange In ActiveSheet.Range("firstRow:lastRow") //not sure how to set and loop through each occurrence of first & last row
COUNTIF(firstRow:lastRow,":") //count the rows containing ":"
Next dateRange
I would like the output to be (in column C):
Call Date: 08/01/2019 19 calls //remember this date and others can span multiple pages
Call Date: 08/02/2019 10 calls
Call Date: 08/03/2019 6 calls
etc...
Thank you very much!