Combining COUNTIF and AND functions

K

KA

Hello,
I want a row counted only if the row contains the letters "AA" in one cell
and does not contain the letters "NOT REQ'D" in another cell of the same row.

The COUNTIF statement works fine. =COUNTIF(A4:A1000,"AA")

However, I tried adding the AND statement but can't get it to work.

Would someone be able to help please?
Merci,
KA
 
K

KA

Biff,

When I entered your formula it doesn't generate an error message, but it
still only counts the total number of "AA" values.

Since the values I'm using are on another worksheet, and the results on
another, the formula I entered was:
=SUMPRODUCT(--('WIs - All Modules'!A4:A1000="AA"),--(F4:F1000<>"NOT REQ'D"))

Would you have any other ideas?
Thanks,
KA
 
T

T. Valko

Are you saying that it counts rows where A= "AA" and F= "NOT REQ'D" ?

If that's the case then there's a "problem" with the data in column F. Is
"NOT REQ'D" the only entry in the cell or is it part of what can be in a
cell? In other words, is "NOT REQ'D" a substring of a larger string?

Common problems with data include unseen leading/trailing spaces. Like this:

<space>NOT REQ'D
NOT REQ'D<space>
<space>NOT REQ'D<space>
 
K

KA

Yes, it counts rows where A= "AA" and F= "NOT REQ'D".
I checked the "NOT REQ'D" value, in the data list, and it does not have
leading or following spaces.

Is there any other way of writing the statement?

KA
 
K

KA

No. The ranges of values are on the same worksheet. The data lists are on
another worksheet.

I tried the latest formula that you posted and it still counts rows where A=
"AA" and F= "NOT REQ'D".

A bit of a mystery, what?
 
T

T. Valko

Well, this is your problem:
The ranges of values are on the same worksheet.
The data lists are on another worksheet.

The formula you posted is testing 2 different sheets:

'WIs - All Modules'!A4:A1000="AA"

And

F4:F1000<>"NOT REQ'D"

Maybe we need this:

=SUMPRODUCT(--('WIs - All Modules'!A4:A1000="AA"),--('WIs - All
Modules'!F4:F1000<>"NOT REQ'D"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top