+ Reply to Thread
Results 1 to 7 of 7

Thread: Multiple Variable Countif?

  1. #1
    Registered User
    Join Date
    08-31-2010
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2003
    Posts
    6

    Multiple Variable Countif?

    I am looking for a formula that will look at text in multiple columns, compare, and give a total number of unique "locations". Attached is a small list showing how each cell can have variables.

    A challenge for my application is that I won't be able to sort, which I think would make it a lot easier. I need a tool that evaluates the entire spreadsheet as is. Is it possible?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,213

    Re: Multiple Variable Countif?

    7? By which column?

    I assume column C and get 5:

    =SUM(IF(FREQUENCY(MATCH(C3:C16, C3:C16, 0), MATCH(C3:C16, C3:C16, 0))>0, 1))
    Last edited by zbor; 09-04-2010 at 12:09 PM.
    "Relax. What is mind? No matter. What is matter? Never mind!"

  3. #3
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Multiple Variable Countif?

    After you add a "key" column to concatenate all the values of your addresses into a single cell for each row, this standard "UNIQUE TOTAL" formula works:

    =SUMPRODUCT((G2:G16<>"") / COUNTIF(G2:G16, G2:G16 & ""))
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  4. #4
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Multiple Variable Countif?

    Is the answer not 6 ?

    If preferred you can avoid the concatenation and use:

    =SUMPRODUCT(--(C3:C16<>""),--(MATCH(C3:C16&"@"&D3:D16&"@"&E3:E16&"@"&F3:F16,C3:C16&"@"&D3:D16&"@"&E3:E$16&"@"&F3:F16,0)=(ROW(C3:C16)-ROW(C3)+1)))
    Not saying you should though... concatenation offers many advantages and if you use helpers I would suggest extending such that SUMPRODUCT/Array is circumvented altogether.

  5. #5
    Registered User
    Join Date
    08-31-2010
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Multiple Variable Countif?

    Thanks, for the input everyone. I've attached a second file showing a sort, and how I came up with 7.

    Amy is a unique location, Doug actually has 2 locations because he has 2 different addresses, etc..so one can see how one change in one cell can result in a "unique location".

    I will try some of the formulas you have suggested, but maybe this new info requires a new approach?
    Attached Files Attached Files

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,213

    Re: Multiple Variable Countif?

    Then you need just to join ranges (You can add more columns by & if you like only keep same principle)...

    =SUM(IF(FREQUENCY(MATCH(A23:A36&C23:C36, A23:A36&C23:C36, 0), MATCH(A23:A36&C23:C36,A23:A36&C23:C36, 0))>0, 1))

    Edit:

    SUM(IF(FREQUENCY(MATCH(A23:A36&C23:C36&E23:E36, A23:A36&C23:C36&E23:E36, 0), MATCH(A23:A36&C23:C36&E23:E36,A23:A36&C23:C36&E23:E36, 0))>0, 1))
    Check also other approaches.
    Last edited by zbor; 09-04-2010 at 12:37 PM.
    "Relax. What is mind? No matter. What is matter? Never mind!"

  7. #7
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Multiple Variable Countif?

    I don't think many people would automatically assume Name as being relevant to a "Location" in a dataset that includes columns: Address, Suite, City & State

    Assuming all columns are relevant and not just C:F adjust the approaches you've been given accordingly - the last SUMPRODUCT ex. would become:

    =SUMPRODUCT(--(A3:A16<>""),--(MATCH(A3:A16&"@"&B3:B16&"@"&C3:C16&"@"&D3:D16&"@"&E3:E16&"@"&F3:F16,A3:A16&"@"&B3:B16&"@"&C3:C16&"@"&D3:D16&"@"&E3:E$16&"@"&F3:F16,0)=(ROW(C3:C16)-ROW(C3)+1)))

+ 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.2.0