+ Reply to Thread
Results 1 to 3 of 3

Count Uniques with String Matching

  1. #1
    Registered User
    Join Date
    07-19-2015
    Location
    Virgina
    MS-Off Ver
    Excel 2010
    Posts
    1

    Count Uniques with String Matching

    Hi,

    I've been trying to get this to work, but need your help.

    I would like to count the UNIQUE people for rows that have a matching string in them. Here is my sample data:
    Please Login or Register  to view this content.
    I would like a formula that can tell me how many "Smiths" live in a City with "Salem" in the string.

    I tried using COUNTIF(D2:D10,"*Salem*"), but get stuck adding in the additional column for [Last] name. Also, I would like to limit the count to unique people. So, I only want to count "John Smith" from Salem, MA once. For this data set, I want the formula to return a count of 2 "Smiths" that live in a City named "Salem".

    Can you help?

    Thank you so much.

  2. #2
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: Count Uniques with String Matching

    PedalPusher, Good evening.

    Try to use:

    =COUNTIFS(A2:A10,"John",B2:B10,"Smith",C2:C10,"MA",D2:D10,"*SALEM*")

    Is that what you're looking for?
    I hope it helps.
    -------------
    Belo Horizonte, Brazil
    Marcílio Lobão
    ...If my answer helped you, Please, click on. * Add Reputation (at left)

    Best regards.
    Marc?lio Lob?o

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Uniques with String Matching

    If I understand what you want I think the correct count is 3.

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    1
    FIRST
    LAST
    STATE
    CITIES
    Smith
    Salem
    3
    2
    John
    Jones
    CT
    Salem, Hartford
    ------
    ------
    ------
    ------
    3
    Sam
    Jones
    CT
    Hartford
    4
    Sam
    Smith
    CT
    Hartford
    5
    John
    Smith
    CT
    Salem
    6
    Sam
    Jones
    MA
    Salem
    7
    John
    Smith
    MA
    Boston, Salem
    8
    John
    Smith
    MA
    Salem, Boston, Concord
    9
    Sam
    Smith
    MA
    Salem
    10
    John
    Smith
    MA
    Concord, Salem


    This array formula** entered in H1:

    =SUM(IF(FREQUENCY(IF((B2:B10=F1)*ISNUMBER(SEARCH(G1,D2:D10)),MATCH(A2:A10&"_"&B2:B10&"_"&C2:C10,A2:A10&"_"&B2:B10&"_"&C2:C10,0)),ROW(D2:D10)-ROW(D2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Rows being counted are 5, 7 and 9.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Count Uniques
    By tiger01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2014, 02:00 AM
  2. Count uniques within duplicates
    By ckramer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2013, 07:06 PM
  3. Count Uniques
    By John Bates in forum Excel General
    Replies: 13
    Last Post: 10-12-2010, 01:57 PM
  4. Count Uniques with 2 criterias
    By ROYW1000 in forum Excel General
    Replies: 2
    Last Post: 11-03-2008, 05:48 PM
  5. count uniques
    By prasjohn in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-20-2008, 01:34 PM
  6. Count uniques, 2 columns
    By krozar in forum Excel General
    Replies: 4
    Last Post: 11-16-2006, 04:48 PM
  7. How to count uniques of a SUMPRODUCT subset?
    By KeLee in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2005, 09:30 AM

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