+ Reply to Thread
Results 1 to 5 of 5

IF statements based on text in a string

  1. #1
    Registered User
    Join Date
    06-28-2005
    Posts
    48

    IF statements based on text in a string

    Hi,

    I want to return Y or N for each row where a certain word (lets say "Apple") appears anywhere in the reference cell. Therefore in the below example the first 3 rows contain apple (somewhere in that cell) so Y is returned. I can get it to work when apple isd the only thing in the cell but not if it appears with text before and/or after it.

    ie:

    A B

    apple Y
    apple orange Y
    orange apple Y
    pear N
    grape N


    Many thanks.

    GW
    Last edited by giantwolf; 12-12-2008 at 12:07 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try

    =If(isnumber(search("apple",A1)),"Y","N")

    where A1 contains original string
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    or
    =IF(ISERROR(FIND("apple",A1)),"N","Y")

  4. #4
    Registered User
    Join Date
    06-28-2005
    Posts
    48
    Thanks guys, very fast responseMuch appreciated
    Last edited by giantwolf; 12-12-2008 at 11:44 AM.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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