Repeated Measures (CountIF and VLookup)

Copper Contributor

Hi all,

 

The data I'm dealing with in Excel has IDs with multiple entries (visit counts), as seen below. Each entry for an ID has been sorted by date (oldest first – not shown) and has been assigned a visit count via the following formula [=COUNTIF($B$2:B2,B2)]. I then assessed each unique ID + visit count by other criteria not shown to determine if they are eligible, also displayed below.

 

My goal is to be able to filter the data so that if an ID is eligible, all ID entries will appear, not just the ones that have a "1" for F2 – Eligible. As you know, when filtering via "Sort and Filter" for those who are eligible, it will only show the specific ID entries that have Eligible = "1". Thus, for ID10013, only the second visit count would appear and not the first. That means I will need to create a new variable that will = "1" for each ID and visit count if ANY visit count of an ID is eligible, but I am unable to determine the formula/code that will allow this to happen. I have tried some versions of VLookup to no success. Any guidance would be greatly appreciated.

 

B2 (ID)C2 (Visit Count)F2 (Eligible)
1000110
1000210
1000310
1000320
1000330
1000340
1000350
1000360
1000370
1000380
1000390
1000410
1000510
1000610
1000710
1000811
1000910
1001010
1001110
1001210
1001220
1001230
1001310
1001321
1001410
2 Replies

@tdwagner 

That could be

=--(COUNTIFS($B$2:$B$26,B2,$D$2:$D$26,">0")>0)

@tdwagner As a variant and in case your Excel version supports the FILTER function:

=IFERROR(VLOOKUP(B2:B26,FILTER(B2:D26,D2:D26=1),3,0),0)