Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter based on condition

OCM

MIS
Joined
Sep 12, 2002
Messages
233
Location
US
Hi,
I have a large dataset where I need to filter out only occurrences of A0020 codes with the following three codes within a week time.
B0480
C0481
D0550
In other words, the above three codes should not be occur with A0020. Attached is the sample file with the expected result on the second tab..

TIA

Regards,
 

Attachments

Assuming your Data is ordered by ID and Date (and Code?), you want the outcome to be:
Rows where Code is:
A0020 and the next row is B0480 or
A0020 and the next row is C0481 or
A0020 and the next row is D0550
as long as the duration between Dates of the 2 above rows is no more than a week.
Is that correct?

Or, do you want to just highlight the above rows where the duration is more than a week?

Is a VBA solution acceptable?

1752676071425.png
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top