I would like to count the number of times a value occurs with multiple columns if another column shows a particular value.

any help would be appreciated!

So I have tried various formulas, each giving me an error code or #value! –

the data I wish to count is within columns D2:F50 and the other column I wish to include is column J2:J50 (if value in J is “Y” then count the number of times value occurs in columns D:F).

This formula returns a #VALUE! =COUNTIFS($D$2:$F$50,D120,J$2:J$50,”Y”)

The code I expect to count the number of times the value of cell D120 appears in columns D:F if the corresponding cell in column J is “Y”.

I keep getting error messages, I think it might be due to the ranges not being the same? I just cannot get it to do what I require.

Thanks for any help in advance!

Regards,

As per my comment:

The reason for your error is that COUNTIFS does expect you to inspect ranges of the same size for criteria. Right now that’s not what you are trying. Instead try:

```
=SUMPRODUCT((D2:F50=D120)*(J2:J50="Y"))
```

Tags: excelexcel, text, time