+ Reply to Thread
Results 1 to 13 of 13

Count searched strings only once per cell

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Count searched strings only once per cell

    Hi,

    Need to count Mother OR Father - but not both.

    Father OR Mother were found 5 times in A1:A6

    Pls see attached WB.

    Thanks, Elm
    Attached Files Attached Files
    Last edited by ElmerS; 09-26-2010 at 09:03 AM.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Count searched strings only once per cell

    Hi. Try this one

    =COUNT(SEARCH({"Mother*","Father*"},A1:A6))-COUNT(SEARCH({"Mother Father","Father Mother"},A1:A6))
    Last edited by contaminated; 09-26-2010 at 04:35 AM.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Count searched strings only once per cell

    Thank you, Vusal,

    You understood what I'm looking for but it seems I was not clear enough.

    The 5 cells were only a short and simple example.

    There could be many combinations - such as:

    Mother Son Father
    Mother Daughter Father


    or should I say "endless" combinations in each cell.

    Elm
    Last edited by ElmerS; 09-26-2010 at 05:44 AM.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Count searched strings only once per cell

    This?

    =COUNTIF(A1:A10, "Mother") + COUNTIF(A1:A10, "Father")
    Never use Merged Cells in Excel

  5. #5
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Count searched strings only once per cell

    Thanks but I don't think so - because "this" returns 2 instead of 7 - as shown in the attached pic.

    Elm
    Attached Images Attached Images

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Count searched strings only once per cell

    Then this,..

    =COUNTIF(A1:A10,"*"& "Mother"&"*") + COUNTIF(A1:A10, "*"&"Father"&"*")

  7. #7
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Count searched strings only once per cell

    If it only would return 7 (as per the last pic I have attached).

    At my end it returns 11.

    Elm

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Count searched strings only once per cell

    Hi ElmerS
    a poor second choice will be code
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Count searched strings only once per cell

    or
    Please Login or Register  to view this content.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Count searched strings only once per cell

    time for bed
    this is set up as a udf
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Count searched strings only once per cell

    Three !!! separate thanks and good night.

    Elm

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

    Re: Count searched strings only once per cell

    try
    =SUMPRODUCT(--(INDEX(--ISNUMBER(SEARCH("mother",A1:A10))&--ISNUMBER(SEARCH("father",A1:A10)),0)<>"00"))
    "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

  13. #13
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Count searched strings only once per cell

    This time a HUGE thank you.

    Have a nice afternoon,

    Elm

+ 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