Share via

Excel is not recognizing a pattern within the COUNTIF formula

Anonymous
2023-01-18T22:27:05+00:00

I need to use the COUNTIF formula on every 40 rows. For example, =COUNTIF(J2:J41,"Yes"). I need this pattern to autofill into 3,000+ cells as follows:

=COUNTIF(J2:J41,"Yes")

=COUNTIF(J42:J81,"Yes")

=COUNTIF(J82:J121,"Yes")

When I try to autofill the formula into the rest of the cells in my column, it autofills in this way, instead of my intended pattern:
=COUNTIF(J3:J42,"Yes")

=COUNTIF(J4:J43,"Yes")

I have tried manually entering the formula into 4 cells, highlighting those cells, and autofilling downwards, however, it still does not recognize my pattern.

I need this formula in 3,000+ cells, so manual entry is not an option.

My Excel Version: Microsoft® Excel® for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20648) 32-bit

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2023-01-18T22:37:21+00:00

Let's say the first formula is in a cell in row 2. Change it to

=COUNTIF(INDEX(J:J, 40*(ROW(A2)-ROW(A$2))+2):INDEX(J:J, 40*(ROW(A2)-ROW(A$2))+41), "Yes")

Fill down.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-01-19T16:18:48+00:00

    This worked. Thanks so much!

    Was this answer helpful?

    0 comments No comments