1 Attachment(s)
Retain set of 4 Days Data, based on Row data in 3 columns, and delete rest
I have a spreadsheet where data (Range A:O) could vary from 1500 rows to 5000 rows daily. Row 1 (A1:O1) has Header, and should remain intact.
Column B, Column C, and Column D could have duplicate data IN ROWS, but 'Column O' having DATE data distinguishes each row.
The current structure is such that, I've lined up data datewise, and in all situations, for identical data series based on column B, ColumnC, and Column D, there should be data for maximum 4 days, on which I can carry on my further analysis, but wherever data set (based on identical data in Column B, ColumnC, and ColumnD is less than 4 days, I want to delete such rows).
So, I need a macro which would do as under;
Wherever, data is less than 4days, I want to delete such rows, and move data(ROW) up.
For instance, in given sample file, (see pic)
http://i.imgur.com/nhW9xYQ.jpg
Row 2 & 3 having similar data (In column B, Column C, Column D) is only for two days (5 Dec 2013, and 6 Dec 2013), so i want to delete these two rows
Row 4 & 5 having similar data (In column B, Column C, Column D) is only for two days (5 Dec 2013, and 9 Dec 2013), so i want to delete these two rows
Row 6, 7, & 8 having similar data (In column B, Column C, Column D) is only for three days (5 Dec 2013, 6 Dec 2013 and 9 Dec 2013), so i want to delete these three rows
BUT
Row 11,12,13,14 has 4 days of sequential data which only, I want to keep.
In my main workbook, there could be several such sets of 4 days data as in case of Row 11 to Row14
Since Row 2 to 10 does not meet my criteria such rows should be deleted and data in subsequent rows should be lifted up. Sample data file is attached.