View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TonyL TonyL is offline
external usenet poster
 
Posts: 17
Default Contains function help

I am trying to write a function where if the cell contains a certain string
to return the data upto that string else return the entire string. Here is
what I have so far:

=IF(SEARCH("(oc:",B1,1)0,LEFT(B1,SEARCH("(oc",B1, 1)-2),B1)

This works if the string exists in the cell but if it doesn't, it returns
#VALUE. Where am I going wrong? TIA
--
Tony