+ Reply to Thread
Results 1 to 9 of 9

Countif containing text but not including other specific texts

  1. #1
    Registered User
    Join Date
    08-11-2015
    Location
    australia
    MS-Off Ver
    2010
    Posts
    3

    Countif containing text but not including other specific texts

    Hi Guys,

    Bit hard to explain what im trying to achieve so i created a simple version. I would like to count how many times the animal "horse" appears in each cell **BUT** if there are multiple animals then i want to exclude the cell.

    E.g. Cell a1 to a7 as follows and D1 = horse

    black dog end
    black cat end
    black horse end
    black horse cat end
    black horse dog end
    black horse cat dog end
    black horse end

    the answer should be 2 however if you do =COUNTIF($A$1:$A$7,"*"&D1&"*") you get 5

    please note the real data can be 200 characters in length and words vary in length and position so LEFT and RIGHT formulas wouldnt work.

    Thanks
    Tom

  2. #2
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Countif containing text but not including other specific texts

    Hi Tom,

    You have "end" too in your string, so your formula can be amended like:
    =COUNTIF($A$1:$A$7,"*"&D1&" end"&"*")

    Blessing

  3. #3
    Registered User
    Join Date
    08-11-2015
    Location
    australia
    MS-Off Ver
    2010
    Posts
    3

    Re: Countif containing text but not including other specific texts

    Hi Khalidngo,

    Thanks for the suggestion. The cells themselves are unfortunately not that simple. End was used as an example in this demo.

    The real data has 5-50 words and there is no common start or end phrases.

    All i have is a list of 10 words and i would like to count 1 word and not count the 9 other words if they appear in the same cell.

    Thanks

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: Countif containing text but not including other specific texts

    Withdrawn by FR.
    Last edited by FlameRetired; 12-22-2015 at 02:43 AM.
    Dave

  5. #5
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Countif containing text but not including other specific texts

    Can you upload a sample workbook with a list of those 10 words which include 9 words that should not be counted. See the following URL for help on how to upload a file.

    http://www.excelforum.com/members/da...ch-a-file.html

  6. #6
    Registered User
    Join Date
    08-11-2015
    Location
    australia
    MS-Off Ver
    2010
    Posts
    3

    Re: Countif containing text but not including other specific texts

    Thanks Dave,

    I copied and pasted cell A6 to A7 to test if the answer would change to 1, instead it jumped to 4.

    :S

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,504

    Re: Countif containing text but not including other specific texts

    I use a helper column to display criteria.
    See attachment.
    Attached Files Attached Files
    Quang PT

  8. #8
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: Countif containing text but not including other specific texts


    Quote Originally Posted by camajto View Post
    [...]the answer should be 2
    [...]
    Row\Col
    A
    D
    F
    1
    black dog end horse cat
    2
    black cat end
    2
    dog
    3
    black horse end horse
    4
    black horse cat end lion
    5
    black horse dog end tiger
    6
    black horse cat dog end jaguar
    7
    black horse end bear

    F1:F7 is defined as AnimalList, i.e., AnimalList refers to F1:F7.

    In D2 control+shift+enter, not just enter:
    Please Login or Register  to view this content.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: Countif containing text but not including other specific texts

    Quote Originally Posted by camajto View Post
    Thanks Dave,

    I copied and pasted cell A6 to A7 to test if the answer would change to 1, instead it jumped to 4.

    :S
    Yes. It appears I didn't withdraw in time.

+ 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. Lookup formula for multiple values including specific text positions
    By gabrielhuman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-18-2015, 12:43 AM
  2. Replies: 9
    Last Post: 07-02-2015, 01:13 AM
  3. Search for multiple texts in cell, return specific text
    By mariur89 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 11-24-2014, 06:43 PM
  4. Equavalent formula for Countif in cell address instead of texts
    By thilag in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-14-2014, 05:12 AM
  5. VB Script to Get full Meta Description including after Quote Mark Texts.
    By ashokpatidar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2013, 06:05 AM
  6. [SOLVED] VLOOKUP containing specific texts
    By JakeMann in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-25-2013, 11:48 AM
  7. Summing specific texts
    By LostLady in forum Excel General
    Replies: 3
    Last Post: 06-09-2005, 01:10 PM

Tags for this Thread

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