Counting character entries while excluding others

Miklopolis

New Member
Joined
Nov 22, 2004
Messages
13
Hi there and thanks for looking. I am attempting to count the number of times any character string appears in a range. In my example I would like to count "STL" and "NYI" but not "—". I know about the COUNTA function and the COUNTIF function. I attempted using a combo. of IF and COUNTA but was unable to get the result I want. Is there a way I can count only the cells where the value is not equal to — ?

Thanks!

MON TUE WED Oct
9-Oct 10-Oct 11-Oct 4th-11th
STL — NYI 2 should go here
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
This formula will count cells not equal to "-"

=COUNTIF(range,"<>-")

but it will include blanks

perhaps

=SUM(COUNTIF(range,{"STL","NYI"}))
 

Watch MrExcel Video

Forum statistics

Threads
1,114,057
Messages
5,545,755
Members
410,704
Latest member
Cobber2008
Top