Hello Folks,
I was wondering if it could be possible to create a VBA code that would:
I have to go through thousand of rows and it's taking forever.
Hopefully someone can kindly help.
Thank you.
Here are the steps I hope the code can perform:
A side note : All groups are separated by and empty row.
Raw Table
Final Result:
I was wondering if it could be possible to create a VBA code that would:
- Find a specific value in Column B
- Compare the times stamps in Column C
- And delete old rows except the row with the oldest timestamp
I have to go through thousand of rows and it's taking forever.
Hopefully someone can kindly help.
Thank you.
Here are the steps I hope the code can perform:
A side note : All groups are separated by and empty row.
- Find all Rows with Values that contain value 10-B in Column B
- If only one value of 10-B is found in Column B, move to the next grouping
- If multiple values of 10-B are found in Column B, then look for the oldest time stamp in Column B, and delete all other rows containg 10-B
- Repeat steps 2-4 in the next grouping
Raw Table
A | B | C |
1 | Event | Time |
2 | 03-A | 9/12/2023 09:11:59.000 |
3 | 10-B | 9/12/2023 19:58:56.000 |
4 | 10-B | 9/12/2023 20:02:06.000 |
5 | 10-B | 9/12/2023 20:03:57.000 |
6 | 10-B | 9/12/2023 20:08:27.000 |
7 | 25-C | 9/14/2023 04:08:07.000 |
8 | ||
9 | 03-A | 9/12/2023 09:11:59.000 |
10 | 10-B | 9/12/2023 20:02:06.000 |
11 | 25-C | 9/14/2023 04:08:07.000 |
12 | ||
13 | 03-A | 9/12/2023 09:11:59.000 |
14 | 10-B | 9/12/2023 19:58:56.000 |
15 | 10-B | 9/12/2023 20:02:06.000 |
16 | 25-C | 9/14/2023 04:08:07.000 |
Final Result:
A | B | C |
1 | Event | Time |
2 | 03-A | 9/12/2023 09:11:59.000 |
3 | 10-B | 9/12/2023 19:58:56.000 |
7 | 25-C | 9/14/2023 04:08:07.000 |
8 | ||
9 | 03-A | 9/12/2023 09:11:59.000 |
10 | 10-B | 9/12/2023 20:02:06.000 |
11 | 25-C | 9/14/2023 04:08:07.000 |
12 | ||
13 | 03-A | 9/12/2023 09:11:59.000 |
14 | 10-B | 9/12/2023 19:58:56.000 |
16 | 25-C | 9/14/2023 04:08:07.000 |