COUNTIF formula Help!!!!!!

Runner10

New Member
Joined
Aug 10, 2015
Messages
18
I have 2 columns of data. The left column is whether the individual has good or bad behavior. The right column is whether the individual had a positive or negative experience in the emergency room. I have this formula below, which tells me if the one individual had both bad behavior AND a negative emergency room experience.

=IF(AND(BI10=7,AX10=3),"Yes","No")



However, I have over 400 individuals in my study. How can I adjust this formula to tell me how many individuals had both bad behavior AND a negative emergency room experience? I'm thinking I have to add COUNT or COUNTIF into the above formula? But I'm not sure how to set this all up.


Any help would be appreciated. Thank you.
 
You might want to work with full colomns in case you add lines later on and add a "0" in the value not to be considered so that if column is empty but A is filled, it does not count it

=SUMPRODUCT(--(A:A=1);1-ISNUMBER(MATCH(B:B;{2;4;7;0};0)))
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Instead of looking for the nots, would it be easier to modify the formula to look for what I want?
=COUNTIF(A16:A417,1)-SUM(COUNTIFS(A16:A417,1,B16:B417,{2,4,7}))

With the above formula, can I change it to count how many people selected choices 1, 3, 5, 6, 8....instead of counting those who did not select choices 2, 4, 7?

Thanks!
 
Upvote 0
I'd go for SumProduct with IsNumber/Match.

=SUMPRODUCT(--(A16:A417=1),1-ISNUMBER(MATCH(B16:B417,ExcludeList,0)))

Or, you like costly COUNTIF(S)...

=COUNTIFS(A16:A417,1)-SUMPRODUCT(COUNTIFS(A16:A417,1,B16:B417,ExcludeList))
 
Upvote 0
Or, you like costly COUNTIF(S)...

Hi Aladin

CountIf() and similar are not so costly in the later versions of excel.

MS now even recommends CountIf() like functions instead of SumProduct().

Check the section

Using SUMPRODUCT for Multiple-Condition Array Formulas

in the article

Excel 2010 Performance: Tips for Optimizing Performance Obstructions

https://msdn.microsoft.com/en-us/library/office/ff726673(v=office.14).aspx

Although Sumproduct() is much more flexible, for simple problems like this one I prefer the functions type CountIf() now.
 
Upvote 0
Hi Aladin

CountIf() and similar are not so costly in the later versions of excel.

MS now even recommends CountIf() like functions instead of SumProduct().

[...]

I did not claim that SumProduct is faster than CountIf(s), but IsNumber/Match is. And I dare to think that:


  1. =SUMPRODUCT(--(A16:A417=1),1-ISNUMBER(MATCH(B16:B417,ExcludeList,0)))
  2. =COUNTIFS(A16:A417,1)-SUMPRODUCT(COUNTIFS(A16:A417,1,B16:B417,ExcludeList))

[1] is faster than [2].
 
Upvote 0

Forum statistics

Threads
1,217,404
Messages
6,136,416
Members
450,010
Latest member
Doritto305

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top