Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How do I handle error conditions with the FIND command?

I have a file of text strings in which some of the strings have a
substring I'm looking for, and others don't.

I tried using the FIND command to determine if the substring exists for
each text string, but when it doesn't ... I get #VALUE! returned.

I would have assumed that since FIND returns the index of the substring,
I would get something nice like "-1" returned when it's not there.

The problem is ... how do I manage the #VALUE! returns? I mean, is that
some kind of value I can test for? For instance, if I wanted to just
list the index of the substring, or write a "0" if it's not there, I
would try something like ...

=IF(FIND(substring,string,1)0,FIND(substring,stri ng,1),0)

But of course, it doesn't work. Can anyone help me?

Thanks!
Jack

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 698
Default How do I handle error conditions with the FIND command?

Try something like this:

=IF(COUNTIF(string,"*"&substring&"*"),FIND(substri ng,string,1),0)

Does that help?
***********
Regards,
Ron

XL2003, WinXP


"mywebaccts (at) PLUGcomcast.net" <"myweb" wrote:

I have a file of text strings in which some of the strings have a
substring I'm looking for, and others don't.

I tried using the FIND command to determine if the substring exists for
each text string, but when it doesn't ... I get #VALUE! returned.

I would have assumed that since FIND returns the index of the substring,
I would get something nice like "-1" returned when it's not there.

The problem is ... how do I manage the #VALUE! returns? I mean, is that
some kind of value I can test for? For instance, if I wanted to just
list the index of the substring, or write a "0" if it's not there, I
would try something like ...

=IF(FIND(substring,string,1)0,FIND(substring,stri ng,1),0)

But of course, it doesn't work. Can anyone help me?

Thanks!
Jack


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I handle error conditions with the FIND command?

=if(isnumber(find(...)),"it's there","it's not there")

Just a reminder =find() is case sensitive. =Search() is not case sensitive.

"mywebaccts (at) PLUGcomcast.net" wrote:

I have a file of text strings in which some of the strings have a
substring I'm looking for, and others don't.

I tried using the FIND command to determine if the substring exists for
each text string, but when it doesn't ... I get #VALUE! returned.

I would have assumed that since FIND returns the index of the substring,
I would get something nice like "-1" returned when it's not there.

The problem is ... how do I manage the #VALUE! returns? I mean, is that
some kind of value I can test for? For instance, if I wanted to just
list the index of the substring, or write a "0" if it's not there, I
would try something like ...

=IF(FIND(substring,string,1)0,FIND(substring,stri ng,1),0)

But of course, it doesn't work. Can anyone help me?

Thanks!
Jack


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How do I handle error conditions with the FIND command?

Ah ... thanks! I think this will do the trick!

Ron Coderre wrote:
Try something like this:

=IF(COUNTIF(string,"*"&substring&"*"),FIND(substri ng,string,1),0)

Does that help?
***********
Regards,
Ron

XL2003, WinXP


"mywebaccts (at) PLUGcomcast.net" <"myweb" wrote:


I have a file of text strings in which some of the strings have a
substring I'm looking for, and others don't.

I tried using the FIND command to determine if the substring exists for
each text string, but when it doesn't ... I get #VALUE! returned.

I would have assumed that since FIND returns the index of the substring,
I would get something nice like "-1" returned when it's not there.

The problem is ... how do I manage the #VALUE! returns? I mean, is that
some kind of value I can test for? For instance, if I wanted to just
list the index of the substring, or write a "0" if it's not there, I
would try something like ...

=IF(FIND(substring,string,1)0,FIND(substring,st ring,1),0)

But of course, it doesn't work. Can anyone help me?

Thanks!
Jack



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How do I handle error conditions with the FIND command?

Thanks! Yeah, I knew the case sensitive difference, but I didn't think
of using isnumber.

Thanks again.


Dave Peterson wrote:

=if(isnumber(find(...)),"it's there","it's not there")

Just a reminder =find() is case sensitive. =Search() is not case sensitive.

"mywebaccts (at) PLUGcomcast.net" wrote:

I have a file of text strings in which some of the strings have a
substring I'm looking for, and others don't.

I tried using the FIND command to determine if the substring exists for
each text string, but when it doesn't ... I get #VALUE! returned.

I would have assumed that since FIND returns the index of the substring,
I would get something nice like "-1" returned when it's not there.

The problem is ... how do I manage the #VALUE! returns? I mean, is that
some kind of value I can test for? For instance, if I wanted to just
list the index of the substring, or write a "0" if it's not there, I
would try something like ...

=IF(FIND(substring,string,1)0,FIND(substring,st ring,1),0)

But of course, it doesn't work. Can anyone help me?

Thanks!
Jack






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How do I handle error conditions with the FIND command?

"Dave Peterson" wrote...
=if(isnumber(find(...)),"it's there","it's not there")

....

Can save a few keystrokes using COUNT instead of ISNUMBER.

=IF(COUNT(FIND(..)),"found","not found")


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I handle error conditions with the FIND command?

I was wondering why you started using =count() in situations like this.

But I think that using =isnumber() is easier to understand for a single cell.


Harlan Grove wrote:

"Dave Peterson" wrote...
=if(isnumber(find(...)),"it's there","it's not there")

...

Can save a few keystrokes using COUNT instead of ISNUMBER.

=IF(COUNT(FIND(..)),"found","not found")


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Showing NULL Command Bar handle [email protected] Excel Discussion (Misc queries) 0 June 4th 07 11:40 AM
Fill handle turned into a move handle Northwoods Excel Discussion (Misc queries) 1 March 2nd 07 03:40 PM
excel command that counts conditions met in 2 columns? brendalw Excel Discussion (Misc queries) 3 July 2nd 05 11:17 PM
Keyboard command to replace double clicking the fill handle Pat Excel Discussion (Misc queries) 1 May 18th 05 05:50 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 10:34 PM.

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

About Us

"It's about Microsoft Excel"