countif vlookup greater than date

mkofler

New Member
Joined
Sep 11, 2003
Messages
34
Greetings Excel Gods!
I'm trying to find out: For each person (ID #), how many times have they been arrested following a program referral? Each arrest is in a separate row:
For each ID number in Workbook1 (column B), search Workbook2 for each instance of that number. For each instance found in Workbook2, look at the date in column D. If the date in Workbook 2 column D is greater than the date in Workbook1 column AQ, then count it and return the total.

Any help would be greatly appreciated. I was thinking that a vlookup would work, but that only seems to find the first instance.
Thanks!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
mkofler said:
Greetings Excel Gods!
I'm trying to find out: For each person (ID #), how many times have they been arrested following a program referral? Each arrest is in a separate row:
For each ID number in Workbook1 (column B), search Workbook2 for each instance of that number. For each instance found in Workbook2, look at the date in column D. If the date in Workbook 2 column D is greater than the date in Workbook1 column AQ, then count it and return the total.

Any help would be greatly appreciated. I was thinking that a vlookup would work, but that only seems to find the first instance.
Thanks!

=SUMPRODUCT(--('[WB2.xls]Sheetname'!$B$1:$B$1000=B1),--('[WB2.xls]Sheetname'!$D$1:$D$1000>AQ1))

Where workbook2 column B holds IDs, workbook2 column D holds dates.
 
Upvote 0
I would use the sumproduct formula.

Put this in C1 and copy down

=SUMPRODUCT(('[Workbook2.xls]Sheet1'!$B$1:$B$5000=B1)*('[Workbook2.xls]Sheet1'!$D$1:$D$5000>=AQ1))


This is assuming that your ID on Workbook1 are in the B column.
 
Upvote 0

Forum statistics

Threads
1,214,521
Messages
6,120,018
Members
448,937
Latest member
BeerMan23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top