View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Search / Find Function

Try something like this:

=COUNT(SEARCH("NY",B2))

Or, another way:

=COUNTIF(B2,"*NY*")

Those will return either 1 or 0. 1 = cell contains NY, 0 = cell does not
conatin NY.

**CAVEAT**

Both of those formulas will return "false positives" if the string NY
appears anywhere within the cell. For example:

B2 = Albany, Georgia

Both formulas will find the "ny" in Albany.

--
Biff
Microsoft Excel MVP


"Harry C." <Harry wrote in message
...
I would like Excel to count all my NY customers; e.g., Search("NY",B2) if
the state code NY is found in a lengthy text field containing a name,
address, comma separators, etc.

The search works fine if NY is in the searched cell, but returns #Value if
not. I can't perform any logical function on the result if it returns
#Value.
How do I get around that?

Thank you.