PDA

View Full Version : Finding IDs



fa2020
09-05-2020, 09:49 AM
Hi,
The same thread has been posted in this address:
https://www.excelforum.com/excel-programming-vba-macros/1326465-detecting-date-errors.html
I tried to simplify it in an another example.
I have an excel file containing thousands of rows. There are ID, Planned Start End Date, and End Date columns.
All IDs needs to have at least one same Planned Start End Date and End Date (equal C and D columns). If an ID doesn't have at least one equal Planned Start End Date and End Date, write them in another cell.
My desired answer is something like this (The answer is at the right side):
27071
Please help me out. :crying:
Thanks.

SamT
09-05-2020, 05:26 PM
Create a unique listing of Ids and Departments in columns F:G

Copy Columns A:D to Columns K:N. Filter them for Uniques

In Column H CountIf Column A matches Column F
In Column I Count If Column K matches Column F

If Column H doesn't equal Column I then that ID does have some matching Start/End Dates

In BooleanSpeak

Dim HasMatches As Boolean
For i = 2 to LastRow
HasMatches = (Cells(i, "H") <> Cells(i, "I"))
'Or
Rows(i).Visible = (Cells(i, "H") = Cells(i, "I"))