+ Reply to Thread
Results 1 to 3 of 3

countif substring from array

  1. #1
    Registered User
    Join Date
    09-01-2010
    Location
    Leiden
    MS-Off Ver
    Excel 2007
    Posts
    2

    countif substring from array

    I want to count the number of times each entry in an array of text strings appears within the array. The tricky part is that I want to count not only exact matches but also strings contained within longer strings, so partial matches as with wildcards (*).
    Take the following example:
    AATTCCGG, =COUNTIF(A1:A3,"*AATTCCGG*")
    TTCCGG, =COUNTIF(A1:A3,"*TTCCGG*")
    ATCGATCG, =COUNTIF(A1:A3,"*ATCGATCG*")
    This returns 1, 2, 1, which is correct (because the second line of data is a substring of the first). The problem is I want to substitute a cell address (e.g., A1) for the actual quoted text string (e.g., AATTCCGG) in the COUNTIF criteria without losing the ability to find a partial match.
    Any ideas?
    Thank you.
    Last edited by 2518GA; 09-01-2010 at 06:12 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: countif substring from array

    Quote Originally Posted by 2518GA
    The problem is I want to substitute a cell address (e.g., A1) for the actual quoted text string (e.g., AATTCCGG) in the COUNTIF criteria without losing the ability to find a partial match.
    You can use ampersand to create the criteria, ie:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-01-2010
    Location
    Leiden
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: countif substring from array

    Pure magic. Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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