I made this formula:

```
=IF(COUNTIF(D5:D8,">0")<>H5,"Yes","No")
```

It works fine, but I need the `COUNTIF`

to skip 5 cells whenever I drag it down. So `D5:D8`

would be `D10:D13`

the next cell, then `D15:D18`

and so on. I can’t figure out how to do this and I really don’t want to manually change 170+ cells.

If anyone could help I would really appreciate it.

If you add a helper column next to your formula that runs in increments of 5, you can use OFFSET to get a drag down that would constantly offset the way you want: (J1 would be your helper column)

```
=IF(COUNTIF(OFFSET($D$5:$D$8,J1,0),">0")<>H5,"Yes","No")
```

This could also be bootlegged in the formula using (ROW(Reference on this Row)-Starting Row of Formula)*5

```
=IF(COUNTIF(OFFSET($D$5:$D$8,(ROW(J1)-1)*5,0),">0")<>H5,"Yes","No")
```

### Answer：

As @Wedge pointed out, `OFFSET`

with `ROW`

is a good way to go:

```
=IF(COUNTIF(OFFSET($D$5:$D$8,(ROW(1:1)-1)*5,0),">0")<>H5,"Yes","No")
```

*However*, `OFFSET`

is a volatile function. It will slow down your workbook if you overuse it.

You can avoid this by using `INDEX`

instead:

```
=IF(COUNTIF(INDEX(D:D,ROW(1:1)*5):INDEX(D:D,ROW(1:1)*5+3),">0")<>H5,"Yes","No")
```

### Answer：

This is untested but I believe the following should do the trick:

```
=IF(COUNTIF(INDIRECT("D" & (ROW(I1)-1)*5+5):INDIRECT("D" & (ROW(I1)-1)*5+8),">0")<>H5,"Yes","No")
```

Assumptions: the formula is in column `I`

and starts at `I1`

you may need to adjust the `-1`

after the row

Tags: excelexcel