+ Reply to Thread
Results 1 to 6 of 6

Count unique values in columns based on 2 criteria (error in one result)

  1. #1
    Registered User
    Join Date
    02-01-2013
    Location
    West Hartford, CT
    MS-Off Ver
    Excel 2013
    Posts
    8

    Count unique values in columns based on 2 criteria (error in one result)

    I am trying to calculate the following values. There is one formula that is not returning the right value. Cell B3 should be returning a value of 3 and it is returning a value of 5.

    Here is the formula:
    =SUM(IF(FREQUENCY(IF((A9:A29<>"")*(B9:B29=""), MATCH(A9:A29,A9:A29,0)),ROW(A9:A29)-MIN(ROW(A9:A29))+1),1))

    The spreadsheet is attached.
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Count unique values in columns based on 2 criteria (error in one result)

    Why?

    I see five e-mail addresses in that range with a blank in the phone column, all of which are unique:

    bbbbb, cccccc, eeeee, ffffffff and gggggg

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    02-01-2013
    Location
    West Hartford, CT
    MS-Off Ver
    Excel 2013
    Posts
    8

    Re: Count unique values in columns based on 2 criteria (error in one result)

    I can't deny I have been looking at this too long so let me clarify:

    I am looking to return a value of 3 since these are the only email addresses with no phone number associated with them in any row.
    bbbbb
    cccccc
    ffffffff

    These two do have phone numbers associated with them on other rows.
    row 14 eeeee
    row 21 ggggg

  4. #4
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Count unique values in columns based on 2 criteria (error in one result)

    this was fun.

    create Named Ranges (ALT > M > N) for your email list and phone list (eml and phn in my case). then use the following ARRAY formula.

    Please Login or Register  to view this content.
    UPDATE:

    inspired by Tony Valko's idea from below, here is a far simpler ARRAY formula:

    Please Login or Register  to view this content.
    Last edited by icestationzbra; 08-17-2013 at 08:50 AM. Reason: uploaded file, simpler formula
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

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

    Re: Count unique values in columns based on 2 criteria (error in one result)

    This one has fewer "moving parts".

    Array entered**:

    =SUM(IF(FREQUENCY(IF(COUNTIFS(A9:A29,A9:A29,B9:B29,"<>")=0,IF(A9:A29<>"",MATCH(A9:A29,A9:A29,0))),ROW(A9:A29)-ROW(A9)+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.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Count unique values in columns based on 2 criteria (error in one result)

    Quote Originally Posted by icestationzbra View Post

    UPDATE:

    here is a far simpler ARRAY formula:

    =SUM(IFERROR(1/((COUNTIFS(eml,eml,phn,"<>")=0)*COUNTIF(eml,eml)),0))
    Nice one!

+ 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. [SOLVED] Count unique entries across columns based on criteria
    By flomme in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 06:43 PM
  2. [SOLVED] Count unique values in columns based on 2 criteria
    By t83357 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 04:33 PM
  3. count unique values of 2 columns with criteria
    By kbalasub in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-16-2013, 12:15 PM
  4. Count unique values across 2 columns with multiple criteria
    By Skywalker01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2012, 08:04 AM
  5. Count unique values based on several criteria
    By evilgrin in forum Excel General
    Replies: 2
    Last Post: 10-10-2010, 03:50 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