+ Reply to Thread
Results 1 to 6 of 6

Searching if a cell contains a specific piece of text in an IF/OR formula

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Searching if a cell contains a specific piece of text in an IF/OR formula

    Hi,

    The subject might be a bit confusing so I will try explain what I'm trying to do. I have an IF formula that looks a cells and if it contains 0 is shows "" (blank)and if its got anything else in it does the rest. What I now am trying to get it to do is, if it displays a 0 or a cell contains the word "Doctor" it displays "" (blank)


    Example below:

    Please Login or Register  to view this content.
    The bit I've underlined is what I thought would be the next logical OR statement, but it doesn't work.

    Any support much appreciated

    John

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Searching if a cell contains a specific piece of text in an IF/OR formula

    The problem is likely that Search returns an Error #Value! if the word Doctor is NOT in the cell T31.

    Try
    =IF(OR('Data Extract'!T31=0,ISNUMBER(SEARCH("Doctor",'Data Extract'!T31,"0"))),"",(" - "&'Data Extract'!T31))

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Searching if a cell contains a specific piece of text in an IF/OR formula

    Alternative using COUNTIF..
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Searching if a cell contains a specific piece of text in an IF/OR formula

    Thanks for the responses. I'm going to use the countifs but is there a way to do it and have the formula look for either "doctor" or "occupational"

    I tired this but is doesn't work:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Searching if a cell contains a specific piece of text in an IF/OR formula

    Ok I figured this out using 2 count ifs. Maybe it would be easier for me to tell the formula to look at things that are NOT a certain text. it this example really I only want the word "Spare" to be shown and if its "Doctor" or "Occupational" or anything else to not show it.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Searching if a cell contains a specific piece of text in an IF/OR formula

    Quote Originally Posted by jshaw82 View Post
    . Maybe it would be easier for me to tell the formula to look at things that are NOT a certain text. it this example really I only want the word "Spare" to be shown and if its "Doctor" or "Occupational" or anything else to not show it.
    Yes. I believe that this is the best option, too. Something like this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 19
    Last Post: 04-10-2013, 08:30 AM
  2. Replies: 1
    Last Post: 12-28-2012, 09:54 PM
  3. [SOLVED] Searching cell for text in specific location and pasting result in another cell
    By AWM1966 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2012, 12:02 AM
  4. [SOLVED] editing a formula to insert a certain piece of text every 7th row
    By bite_tony in forum Excel General
    Replies: 10
    Last Post: 04-19-2012, 04:26 AM
  5. Searching for specific text within a cell
    By plannerg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2006, 05:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1