Closed Thread
Results 1 to 11 of 11

If cell contains...

  1. #1
    Tim Sampson
    Guest

    If cell contains...

    Hi

    I'm sure this must be the easiest question ever but it's proving very
    difficult for me to find in the help and on Google.

    What is the Excel function that says "if A1 contains "fred" then 1, else
    0".

    Note, A1 might contain Fred, Freddy or Alfredo, all should match.

    TIA
    Tim

  2. #2
    Guest

    If cell contains...

    hi
    =IF(A1="Fred",1,IF(A1="Freddy",1,if(A1="Alfredo",1,0)))

    >-----Original Message-----
    >Hi
    >
    >I'm sure this must be the easiest question ever but it's

    proving very
    >difficult for me to find in the help and on Google.
    >
    >What is the Excel function that says "if A1

    contains "fred" then 1, else
    >0".
    >
    >Note, A1 might contain Fred, Freddy or Alfredo, all

    should match.
    >
    >TIA
    >Tim
    >.
    >


  3. #3
    Peo Sjoblom
    Guest

    Re: If cell contains...

    =--(ISNUMBER(SEARCH("fred",A1)))

    --

    Regards,

    Peo Sjoblom

    "Tim Sampson" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > I'm sure this must be the easiest question ever but it's proving very
    > difficult for me to find in the help and on Google.
    >
    > What is the Excel function that says "if A1 contains "fred" then 1, else
    > 0".
    >
    > Note, A1 might contain Fred, Freddy or Alfredo, all should match.
    >
    > TIA
    > Tim




  4. #4
    Tim Sampson
    Guest

    Re: If cell contains...

    <[email protected]> wrote in news:0fae01c51438$df781480
    [email protected]:

    > hi
    > =IF(A1="Fred",1,IF(A1="Freddy",1,if(A1="Alfredo",1,0)))


    Thanks but that's not quite what I was asking for. I might not know all the
    different permutations. I want contains "fred".

    Tim

  5. #5
    Ken Wright
    Guest

    Re: If cell contains...

    =--(COUNTIF(A1,"*fred*")>0)

    --
    Regards
    Ken....................... Microsoft MVP - Excel
    Sys Spec - Win XP Pro / XL 97/00/02/03

    ----------------------------------------------------------------------------
    It's easier to beg forgiveness than ask permission :-)
    ----------------------------------------------------------------------------

    "Tim Sampson" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > I'm sure this must be the easiest question ever but it's proving very
    > difficult for me to find in the help and on Google.
    >
    > What is the Excel function that says "if A1 contains "fred" then 1, else
    > 0".
    >
    > Note, A1 might contain Fred, Freddy or Alfredo, all should match.
    >
    > TIA
    > Tim




  6. #6
    Tim Sampson
    Guest

    Re: If cell contains...

    "Peo Sjoblom" <[email protected]> wrote in news:usYMxjDFFHA.3492
    @TK2MSFTNGP12.phx.gbl:

    > =--(ISNUMBER(SEARCH("fred",A1)))
    >


    ISNUMBER, SEARCH and FIND all added to my portfolio.

    Thanks very much
    Tim

  7. #7
    Tim Sampson
    Guest

    Re: If cell contains...

    "Ken Wright" <[email protected]> wrote in news:#LEJasDFFHA.4072
    @TK2MSFTNGP10.phx.gbl:

    > =--(COUNTIF(A1,"*fred*")>0)
    >


    What is the =-- for?

    Tim

  8. #8
    Ken Wright
    Guest

    Re: If cell contains...

    Without it the formula will return TRUE or FALSE. The -- will convert TRUE
    to 1 and FALSE to 0

    http://www.mcgimpsey.com/excel/formulae/doubleneg.html

    --
    Regards
    Ken....................... Microsoft MVP - Excel
    Sys Spec - Win XP Pro / XL 97/00/02/03

    ----------------------------------------------------------------------------
    It's easier to beg forgiveness than ask permission :-)
    ----------------------------------------------------------------------------

    "Tim Sampson" <[email protected]> wrote in message
    news:[email protected]...
    > "Ken Wright" <[email protected]> wrote in

    news:#LEJasDFFHA.4072
    > @TK2MSFTNGP10.phx.gbl:
    >
    > > =--(COUNTIF(A1,"*fred*")>0)
    > >

    >
    > What is the =-- for?
    >
    > Tim




  9. #9
    Registered User
    Join Date
    02-21-2005
    Posts
    1
    Quote Originally Posted by Ken Wright
    Without it the formula will return TRUE or FALSE. The -- will convert TRUE
    to 1 and FALSE to 0

    http://www.mcgimpsey.com/excel/formulae/doubleneg.html
    Is there a way to change this from 1/0 to something else? For example, I'd like to have something like a YES if its true but just a blank cell if false.

    Thanks

  10. #10
    Registered User
    Join Date
    09-10-2009
    Location
    Boston,MA,USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: If cell contains...

    How would I do If an cell contains "-" then do =LEFT(B2,FIND("-",B2)-1) else b2

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: If cell contains...

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

Closed 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