I have a table like the following:

I’m trying to count all of the rows that meet a certain criteria:

If *a DEC* is less than *c DEC* AND *a APR* is greater than *c APR* OR if *a DEC* is less than *d DEC* AND *a APR* is greater than *d APR* then count those rows.

This is the formula that I’m currently using, but it is incorrect:

```
=SUMPRODUCT((G4:G6<K4:K6)*(H4:H6>L4:L6)+(G4:G6<M4:M6)*(H4:H6>N4:N6))
```

That formula will give a sum of 4 for that example table, when what I am looking for is a sum of 3.

Any help would be appreciated!

EDIT: Here’s a picture of the table with more info:

You can avoid the duplicate counting by checking how many returned values are greater than zero, then use that against the data in G (or any other column)

```
=SUMPRODUCT((((G4:G6<K4:K6)*(H4:H6>L4:L6)+(G4:G6<M4:M6)*(H4:H6>N4:N6))>0)*G4:G6)
```

Using the Evaluate Formula tool, you can step through the formula and see where you need adjustments.

Tags: arraysarrays