negative countifs

Andy83UK

Board Regular
Joined
Jun 4, 2010
Messages
142
I am trying to use a formula to count a large number of occurences on a spreadsheet subtracting away a couple of variables, so far I haven't been able to acheive this on a test sheet.

The formula I'm trying to make work is

=COUNTA((B2:B14))-COUNTIFS(B2:B14,"e",B2:B14,"f")

I think that is basically doing what I require as I want to toal up a much larger sheet of a couple of thousand rows of info minusing away any with the criteria of e and f.

Thanks
For your help.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try:
=COUNTA(B2:B14)-COUNTIF(B2:B14,"e")-COUNTIF(B2:B14,"f")
 
Upvote 0
You could also use:
=COUNTA(B2:B14)-SUM(COUNTIF(B2:B14,{"e","f"}))
if you wanted.
 
Upvote 0
thanks that second one may be simpler in longer formulas of which this will likely be a part i think.
 
Upvote 0
Is there a way to have this formula work with an if criteria before it?

such as if $M:$M = Dee then perform this action?
 
Upvote 0
I think you'd need SUMPRODUCT for that. Do you mean count where M is "Dee" and B is not "e" or "f" (can B be blank?)?
 
Upvote 0
i am trying

=IF($A:$A=A6,"")*(COUNTA(B2:B14)-COUNTIF(B2:B14,"e")-COUNTIF(B2:B14,"f"))

where A6 = Dee
 
Upvote 0
Yes B could possibly be blank but shouldn't M could be a variety of possibilities including a lot of blanks but I would change the formula's entry for M's criteria as needed.

the formula where i've been using Columns A and B is just on a blank test sheet.
 
Upvote 0
Something like:
=SUMPRODUCT(($A$2:$A$10="Dee")*ISNA(MATCH($B$2:$B$10,{"e","f"},0))*($B$2:$B$10<>""))
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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