count if and ignore blanks

lachone

New Member
Joined
Jun 8, 2017
Messages
24
Hello,

I want to count the cells in a column that do not say "this" or "that" and ignore blank cells.

Thanks in advance for your help
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,729
Hello,

I want to count the cells in a column that do not say "this" or "that" and ignore blank cells.

Thanks in advance for your help
Can any of the cells contain both "this" and "that"?
 

NickRed18

Board Regular
Joined
May 25, 2017
Messages
76
My range is A1:A25, so change as needed:
Code:
=COUNTA(A1:A25)-COUNTIF(A1:A25,"this")-COUNTIF(A1:A25,"that")
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,729
perfect!!! Thank you!!!
That double counts if any cells contain both "this" and "that" and doesn't account for strings that include either word. See post #6.
 

NickRed18

Board Regular
Joined
May 25, 2017
Messages
76
I had no idea about asterisks behaving that way! Is that a property unique to COUNT, or does it work for Match, Lookup, etc.
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,729
I think you need to add back in the case for "*that*this*" as well.
Good catch Rick! That would make it:
Code:
=COUNTA(A:A)-COUNTIF(A:A,"*this*")-COUNTIF(A:A,"*that*")+COUNTIF(A:A,"*this*that*")+COUNTIF(A:A,"*that*this*")
 

Watch MrExcel Video

Forum statistics

Threads
1,095,185
Messages
5,442,876
Members
405,206
Latest member
warviksam

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top