A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search / Find Function



 
 
Thread Tools Display Modes
  #1  
Old June 16th, 2009, 04:55 PM posted to microsoft.public.excel.worksheet.functions
Harry C.
external usenet poster
 
Posts: 1
Default Search / Find Function

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.
  #2  
Old June 16th, 2009, 04:59 PM posted to microsoft.public.excel.worksheet.functions
eduardo
external usenet poster
 
Posts: 2,131
Default Search / Find Function

Hi,
Please post your formula

"Harry C." wrote:

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.

  #3  
Old June 16th, 2009, 05:07 PM posted to microsoft.public.excel.worksheet.functions
Harry C.[_2_]
external usenet poster
 
Posts: 1
Default Search / Find Function

Here it is:

=IF(SEARCH("NY",G884),1,0) (I've tried the same with FIND).

Here is a sample cell: Joe Smith, 7951 Dorcas Street, Philadelphia, PA,
19111, United States

You'll see that he is not from NY. When I apply either the FIND or SEARCH to
such a cell, Excel returns #VALUE! and I can't do anything with that.

Thank you.

"Eduardo" wrote:

Hi,
Please post your formula

"Harry C." wrote:

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.

  #4  
Old June 16th, 2009, 05:17 PM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
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.



  #5  
Old June 16th, 2009, 05:26 PM posted to microsoft.public.excel.worksheet.functions
eduardo
external usenet poster
 
Posts: 2,131
Default Search / Find Function

Hi
try

=IF(ISERR(SEARCH("NY",G884)),0,SEARCH("NY",G884))

if this helps please click yes, thanks

"Harry C." wrote:

Here it is:

=IF(SEARCH("NY",G884),1,0) (I've tried the same with FIND).

Here is a sample cell: Joe Smith, 7951 Dorcas Street, Philadelphia, PA,
19111, United States

You'll see that he is not from NY. When I apply either the FIND or SEARCH to
such a cell, Excel returns #VALUE! and I can't do anything with that.

Thank you.

"Eduardo" wrote:

Hi,
Please post your formula

"Harry C." wrote:

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.

  #6  
Old June 16th, 2009, 05:27 PM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default Search / Find Function

Here is a sample cell: Joe Smith, 7951 Dorcas Street,
Philadelphia, PA, 19111, United States


WRT my other post, try it like this:

=COUNTIF(B2,"* NY, *")


--
Biff
Microsoft Excel MVP


"Harry C." wrote in message
...
Here it is:

=IF(SEARCH("NY",G884),1,0) (I've tried the same with FIND).

Here is a sample cell: Joe Smith, 7951 Dorcas Street, Philadelphia, PA,
19111, United States

You'll see that he is not from NY. When I apply either the FIND or SEARCH
to
such a cell, Excel returns #VALUE! and I can't do anything with that.

Thank you.

"Eduardo" wrote:

Hi,
Please post your formula

"Harry C." wrote:

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.



  #7  
Old June 16th, 2009, 05:40 PM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Search / Find Function

Try

=COUNTIF(A1,"*NY*")

--
If this post helps click Yes
---------------
Jacob Skaria


"Harry C." wrote:

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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.