ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Countif with multiple text values in cell (https://www.excelbanter.com/excel-discussion-misc-queries/177744-countif-multiple-text-values-cell.html)

Rothman

Countif with multiple text values in cell
 
I have a column of state abbreviations and am simply trying to count how many
times each state appears in the column.

Unfortunately, there are some cells in the column that contain two or more
states. Countif doesn't like that (i.e if VA is in one cell and "MD VA NY"
is in another, it doesn't count VA twice).

What do I do? This isn't the only data in my sheet, so adding columns would
be...messy.

FSt1

Countif with multiple text values in cell
 
hi
=countif(A1:A50,"*VA*")

use the wildcard * in the search. adjust range to suit.

Regards
FSt1

"Rothman" wrote:

I have a column of state abbreviations and am simply trying to count how many
times each state appears in the column.

Unfortunately, there are some cells in the column that contain two or more
states. Countif doesn't like that (i.e if VA is in one cell and "MD VA NY"
is in another, it doesn't count VA twice).

What do I do? This isn't the only data in my sheet, so adding columns would
be...messy.


Rothman

Countif with multiple text values in cell
 
Works like a charm! Thanks!

"FSt1" wrote:

hi
=countif(A1:A50,"*VA*")

use the wildcard * in the search. adjust range to suit.

Regards
FSt1

"Rothman" wrote:

I have a column of state abbreviations and am simply trying to count how many
times each state appears in the column.

Unfortunately, there are some cells in the column that contain two or more
states. Countif doesn't like that (i.e if VA is in one cell and "MD VA NY"
is in another, it doesn't count VA twice).

What do I do? This isn't the only data in my sheet, so adding columns would
be...messy.


T. Valko

Countif with multiple text values in cell
 
Try this:

=COUNTIF(A1:A10,"*Va*")

Or, use a cell to hold the criteria:

C1 = Va

=COUNTIF(A1:A10,"*"&C1&"*")

If a cell might hold:

MD VA VA

And you need to count that as 2 then you'll need a different formula. Let us
know if that's the case.


--
Biff
Microsoft Excel MVP


"Rothman" wrote in message
...
I have a column of state abbreviations and am simply trying to count how
many
times each state appears in the column.

Unfortunately, there are some cells in the column that contain two or more
states. Countif doesn't like that (i.e if VA is in one cell and "MD VA
NY"
is in another, it doesn't count VA twice).

What do I do? This isn't the only data in my sheet, so adding columns
would
be...messy.





All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com