#1   Report Post  
Brook6
 
Posts: n/a
Default IF-SEARCH

I want to search a text/number string to see if it has a dash "-" and if it
does, I want to insert a value and if it doesn't, I want a different value

I tried...
IF(SEARCH("-",A2)0
....which works fine if the string does have a dash, but bombs to #VALUE!
errror if the string does not have a dash

Any help appreciated!
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

=IF(ISNUMBER(SEARCH("-",A1)),"value_1","value_2")

HTH
Jason
Atlanta, GA

-----Original Message-----
I want to search a text/number string to see if it has a

dash "-" and if it
does, I want to insert a value and if it doesn't, I want

a different value

I tried...
IF(SEARCH("-",A2)0
....which works fine if the string does have a dash, but

bombs to #VALUE!
errror if the string does not have a dash

Any help appreciated!
.

  #3   Report Post  
Harlan Grove
 
Posts: n/a
Default

"Jason Morin" wrote...
=IF(ISNUMBER(SEARCH("-",A1)),"value_1","value_2")


Alternatives.

=IF(COUNTIF(A1,"*-*"),"Yay!","Boo!")

=IF(SUBSTITUTE(A1,"-","")<A1,"Yay!","Boo!")


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
Print the results of a search Celestina Excel Discussion (Misc queries) 1 January 12th 05 01:04 AM
Q: search in string JIM.H. Excel Discussion (Misc queries) 5 January 5th 05 10:24 PM
Excel 2000 - How to create an auto search echo7 Excel Discussion (Misc queries) 1 December 17th 04 04:32 PM
Search for a Sheet Chance224 Excel Discussion (Misc queries) 3 December 14th 04 12:29 AM
better search: "make worksheet visible" christo Excel Discussion (Misc queries) 1 December 1st 04 12:20 AM


All times are GMT +1. The time now is 04:20 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"