Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COUNTIF function with multiple conditions 1

Status
Not open for further replies.

Edge118

Programmer
Jun 15, 2004
104
0
0
US
I have two columns, A and B. I need to write a formula to count how many rows contain the value 2 in column A and the value 3 in column B.

I was messing around with the COUNTIF function, but it looks like you can only use one column of data for this function. Any help you can provide is appreciated.

Thanks,
Chris

"Pin me. Perl me."

Regards,

Chris
 
For use in a criteria such as the context that you are implying, yes, that would work and probably be quite efficient. The same results can be retreived via the array-entered formula that xlhelp gave. The way I was taking the OPs question was not a multiconditional computing, but count all the 2's in col A and count all the 3's in col B. I didn't see anything that said count only if there is a 2 in col A and a 3 in col B for each respective row. That could either be the OP not posting a very well versed question or me interpreting it differenty (probably the latter).



-----------
Regards,
Zack Barresse
 
I didn't see anything that said count only if there is a 2 in col A and a 3 in col B for each respective row.

It was in four or five posts, not just the first one.

If your whole point was that COUNTIF should be used instead of SUMPRODUCT in cases where there is just one criteria, then I feel compelled to tell you that that is common knowledge around here. We already knew that COUNTIF is efficient. (I diagree that it is underrated, best I can tell everyone likes it.) We already knew that SUMPRODUCT has the "last row bit" and it is used for things other than what was intended.

neither one is really more "right" than the other; it boils down to preference
I disagree. COUNTIF is more "right" when there is one criteria. But in cases like this one, it is useless.

I gotta tell you it has been quite a while since I have let some one waste my time like I did today.



 
Lilliabeth, sorry you feel that way. I think we've all got the same goal here. I apologize for any bad feelings this may have had. I'm chalking it up to us all playing on the same team and not really communicating very well (yes, mostly on my part I'm sure). If anybody's time is wasted, well hun, it's not just yours.

As far as "around here," well, I don't know exactly what that is supposed to mean. I understand what *you* express it to mean, but where forums rate does not mean much in my book. I've seen some very impressive solutions given here and I've also seen some pretty pathetic solutions as well. It happens at many forums (and I visit a lot); some excel in specific areas, some in others, not all being the same. Don't feel the need to tell me or point anything out to me, I'm well versed and can see things quite clearly for myself, thank you.

I wish we'd met under better circumstances, I think we could have gotten along fairly well as I'm (generally and usually) a very easy going guy and easy to get along with. But if you're ever in Eastern Oregon, I'll buy you a beer/coffee, maybe you'll allow me to make amens. ;)

-----------
Regards,
Zack Barresse
 
I think the OP should just count them all manually and then type the answer in each time. :)

Regards
Ken............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top