# Countifs formula across multiple sheets

#### jme_4477

##### New Member
I need to compare student IDs on sheets Adds Drops (Column B) to Sheet2 (Column C), and then cross-reference that with the date on both sheets: Adds Drops (Column B) and Sheets2 (Column I). If the dates on Sheets2 (Column I) is more than 7 days later than the date on Adds Drops (Column B) for any student ID, I need a total. So if any students have not been contacted in more than 7 days, it should just give me the total number of students with no contact. This total will appear on a different sheet all together.

Here's a link to the file:

##### Active Member
Google Drive says "Sorry, the file you have requested does not exist.
Make sure that you have the correct URL and the file exists."

##### Active Member
jme_4477,

You'll need to extend the Sheet2 search as far down as you may enter data but this should do what you want. In Adds Drops I added column D and copied this formula down:
=IFERROR(IF(INDEX(Sheet2!\$I\$2:\$I\$33,MATCH(B1,Sheet2!\$C\$2:\$C\$33,0))-7>A1,1,0),0)

E1 is the total you want to put on another sheet and is just: =SUM(D:D)

ABCDE
130-Jul2833720Whalan, John13
20
315-Jul2827280Harley, Bee1
415-Jul2787711Spitz, Alex1
515-Jul2834784Teeper, Daxter0
60
715-Aug2827597Lyning, Abby0
80
918-Aug2837420Marble, Dustin0

</tbody>

Worksheet Formulas
CellFormula
D1
=IFERROR(IF(INDEX(Sheet2!\$I\$2:\$I\$33,MATCH(B1,Sheet2!\$C\$2:\$C\$33,0))-7>A1,1,0),0)

</tbody>

<tbody>
</tbody>

Regards,

#### jme_4477

##### New Member
Oh my goodness! Thank you SO much!!!!!! I do have one question though. To extend the search in Sheet2, I would just enter in a higher number like 400 instead of 33, right?

#### jme_4477

##### New Member
Also, I was playing around with my spreadsheet, and I'm not sure it's working correctly. For example, Alex Spitz had a Welcome WM on on 8/12 (Sheet2 I4) and WC on 8/14 (Sheet2 J4). However, on the Adds Drops sheet, it's showing Alex had no Welcome WM or WC for greater than 7 days. Do you know how to fix this?

Here's the new doc:

##### Active Member
The dates 8/12 and 8/14 are both more than 7 days later than 15-Jul so I don't understand why Alex Spitz shouldn't be counted?

Your original request was "If the dates on Sheets2 (Column I) is more than 7 days later than the date on Adds Drops (Column B) for any student ID, I need a total." and there was no mention of column J for "WC Date" but I see you've added that in.

Columns D and E in this example are the formula I had for the WW check.
Columns M and N are the ones you added to check WC date.
I wasn't sure if you wanted the counts separate so I've added two more pairs:
• G and H: Checks "Welcome WM" and "WC Date" and if either are more than 7 days after the Adds Drops date then it adds to the count.
• J and K: Checks "Welcome WM" and "WC Date" and if both are more than 7 days after the Adds Drops date then it adds to the count.

Yes, to extend just change those ranges. I've changed them all to \$193 in my example because that seemed to be the end of the table and the User Id column had some spaces in C196 and C200 so it seemed unsafe to go further.

dd

ABCDEFGHIJKLMN
1WW >7daysWW OR WC >7daysWW AND WC >7daysWC >7days
21-Aug2833720Whalan, John12121212
30000
48-Aug2827280Harley, Bee0000
515-Jul2787711Spitz, Alex1111
615-Jul2834784Teeper, Daxter0000
70000
815-Aug2827597Lyning, Abby0000
90000
1018-Aug2837420Marble, Dustin0000

<tbody>
</tbody>

Worksheet Formulas
CellFormula
D2=IFERROR(IF(INDEX(Sheet2!\$I\$2:\$I\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2,1,0),0)
E2=SUM(D:D)
G2=IFERROR(IF(OR(INDEX(Sheet2!\$I\$2:\$I\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2,INDEX(Sheet2!\$J\$2:\$J\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2),1,0),0)
H2=SUM(G:G)
J2=IFERROR(IF(AND(INDEX(Sheet2!\$I\$2:\$I\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2,INDEX(Sheet2!\$J\$2:\$J\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2),1,0),0)
K2=SUM(J:J)
J10=IFERROR(IF(AND(INDEX(Sheet2!\$I\$2:\$I\$193,MATCH(B10,Sheet2!\$C\$2:\$C\$193,0))-7>A10,INDEX(Sheet2!\$J\$2:\$J\$193,MATCH(B10,Sheet2!\$C\$2:\$C\$193,0))-7>A10),1,0),0)
M2=IFERROR(IF(INDEX(Sheet2!\$J\$2:\$J\$193,MATCH(B2,Sheet2!\$C\$2:\$C\$193,0))-7>A2,1,0),0)
N2=SUM(M:M)

<tbody>
</tbody>

<tbody>
</tbody>

#### jme_4477

##### New Member
I cannot thank you enough!!! You are amazing!!!!!!!

You're welcome!

#### jme_4477

##### New Member
Hello,

I'm sorry to bother you, but I have one final question. What would the formula be to count WC Date if there is no date entered for over 7 days from the date in Adds Drops? In other words, if you look at Sheet2, you can see that Bee Harley and Dustin Marble have no date entered in the WC Date column. Then if you look at Adds Drops, you can see that Bee was added on 8/8, and Dustin was added on 8/18. How can I calculate if the date entered on the Sheet2 sheet is over 7 days or if there is not date entered and it is over 7 day from the date entered on the Adds Drops sheet. You helped me with the first part last time, but I didn't realize that I also need the second part.

Here's the link to the doc:

Thank you again SO much!!!

I need to compare student IDs on sheets Adds Drops (Column B) to Sheet2 (Column C), and then cross-reference that with the date on both sheets: Adds Drops (Column B) and Sheets2 (Column I). If the dates on Sheets2 (Column I) is more than 7 days later than the date on Adds Drops (Column B) for any student ID, I need a total. So if any students have not been contacted in more than 7 days, it should just give me the total number of students with no contact. This total will appear on a different sheet all together.