+ Reply to Thread
Results 1 to 10 of 10

Find some text in the column A

  1. #1
    Registered User
    Join Date
    07-02-2014
    Location
    Prague
    MS-Off Ver
    2007
    Posts
    59

    Find some text in the column A

    Hi, I am wondering. Is there any function that could find certain text in a whole column?

    For example: I wanna find the word "apple" in the column A:A ... if there is such word, the result would be "yes" if not, the result would be "no"

    Thank you for your insight.
    Any help will be appreciated *.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Find some text in the column A

    depends what's in the cells
    if its just a single word "apple"
    if(countif(a:a,"apple"),"yes","no")
    if there is other text
    like
    a red apple
    if(countif(a:a,"*apple*"),"yes","no")
    Last edited by martindwilson; 08-01-2014 at 06:48 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    07-22-2014
    Location
    Riyadh
    MS-Off Ver
    2010
    Posts
    88

    Re: Find some text in the column A

    =IFERROR(IF(MATCH("*apple*",A:A,0)>0,"yes","no"),"No")

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Find some text in the column A

    well thats a more complicated method

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Find some text in the column A

    Simplified version:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Find some text in the column A

    why match when countif suffices?

  7. #7
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Find some text in the column A

    Good morning Martin!
    I think a similar question could be asked in a lot of threads? Why add another, different solution when a solid, good solution already exist?

    One reason is the same reason (I guess) as we all hang out here on the forum in the first place, it's fun to solve these Excel formula puzzles and it's rewarding to help people.
    I've been on a dry spell of suitable problems recently and I found the simplification of mohamedJamsheer's formula a fun little puzzle to solve.

    While I technically don't help OP (who already has a good solution), I still feel like I am contributing by showing a better way to use MATCH in this context. OP may not be interested in this but mohamedJamsheer and anyone else who reads this thread in the future may be. One could of course argue that supplying an improved version of a previous formula in the thread AFTER a proper solution has already been supplied is off topic or something but I think it's ok.

    Perhaps your question was of a more technical character and you were wondering if I think there is an advantage in using MATCH instead of COUNTIF? No, I don't think so. I imagine (haven't tested) the speed being the same. Your COUNTIF formula is very clean, compact and easy to understand. There is no rational, technical argument to justify using MATCH in this context, just irrational non-technical ones

  8. #8
    Registered User
    Join Date
    07-02-2014
    Location
    Prague
    MS-Off Ver
    2007
    Posts
    59

    Re: Find some text in the column A

    Thank you guys, that helped a lot.

  9. #9
    Registered User
    Join Date
    07-22-2014
    Location
    Riyadh
    MS-Off Ver
    2010
    Posts
    88

    Re: Find some text in the column A

    Hi Jacc
    you are right, count if formula will work perfectly and i have not read your second formula before.
    thanks,

  10. #10
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Find some text in the column A

    Thanks for the feedback mohamedJamsheer and Martin! This forum is a good place to hang out.

    However, I just realized that I didn't mean some of the nice things I said about Martin's COUNTIF formula (sort of anyway). I'm talking about the part where I said that it is easy to understand. I don't think it is easy to understand for a beginner.

    It may not be obvious to you, royalB and mohamedJamsheer, why the IF part in Martin's formula works since the COUNTIF part does not produce a TRUE or FALSE which is the normal input to an IF formula.

    Common knowledge says that 0 corresponds to FALSE and 1 corresponds to TRUE. However, Excel interprets 0 as FALSE and ANY number larger or smaller than 0 as TRUE.

    One would think that Martin's formula should really look like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    but because of what I mentioned above the >0 part can simply be skipped.

    There! I'm done ranting in this thread.

+ 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. VBA Code to Find Specified text within a Column and perform Text to Column
    By MHamid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-26-2014, 06:42 AM
  2. Replies: 4
    Last Post: 12-20-2012, 04:33 AM
  3. [SOLVED] VBA to Search a Text String, Find a Value listed in another column and replace the text
    By Jschrod303 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2012, 08:56 PM
  4. [SOLVED] Find Specific Text in Text String and Return Value in Adjacent Column
    By watchouse in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 03:53 PM
  5. Replies: 1
    Last Post: 09-01-2011, 12:05 AM

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