+ Reply to Thread
Results 1 to 9 of 9

Count unique text values within a range based on another column

  1. #1
    Registered User
    Join Date
    10-14-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    2

    Count unique text values within a range based on another column

    Hi all,
    I've searched the board for this one and I have not had any luck. I would like to count the number of unique text values in column (B) that fall within a specified range of column (A). For example...

    A B
    (Depth) (Fish)
    2 HFBD
    4 BLK
    6
    8 BLK
    10
    12 BLU

    Given the table above, count the number of unique species in column B that are at a depth greater than or equal to two (2) and less than or equal to six (6). Note that Column A is continuous but B has some blanks.

    My actual data set spans hundreds of meters and species of fish...so generating this function is key. Ultimately, I want to count to number of unique values by specifying a depth range in another column.

    I am using Excel 2010

    Thank you in advance.
    Cheers

    {UPDATE}
    I've included a sample data set.
    Attached Files Attached Files
    Last edited by Sebastes; 10-14-2014 at 01:25 PM.

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Count unique text values within a range based on another column

    Hi,

    to be confirmed with control+shift+enter


    Please Login or Register  to view this content.
    Regards
    Last edited by canapone; 10-14-2014 at 01:12 PM. Reason: parenthesis out of code
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  3. #3
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Count unique text values within a range based on another column

    Hi,

    See the file, yellow cell has formula.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Count unique text values within a range based on another column

    Hi,

    again a small patch to exclude from counting blanks



    Please Login or Register  to view this content.

    Cheers
    Attached Files Attached Files
    Last edited by canapone; 10-14-2014 at 01:15 PM.

  5. #5
    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 text values within a range based on another column

    Hi.

    I think you probably need to resolve blanks in column B as well.

    Array formula**:

    =SUM(IF(FREQUENCY(IF(B2:B100<>"",IF(ABS(4-A2:A100)<=2,MATCH(B2:B100,B2:B100,0))),ROW(B2:B100)-MIN(ROW(B2:B100))+1),1))

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Click * below if this answer helped

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

  6. #6
    Registered User
    Join Date
    10-14-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    2

    Re: Count unique text values within a range based on another column

    Thank you all for the quick replies. None of the formulas are quite working, even after adjusting them to fit my data set. I've included a sample data set above.

  7. #7
    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 text values within a range based on another column

    I can't seem to see your attempts at adapting the solutions provided in that file? Did you upload the correct one?

    Regards

  8. #8
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Count unique text values within a range based on another column

    See the file.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Count unique text values within a range based on another column

    Just a small modification from the formula in file do -1, so the formula in E2 will be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Confirm with Ctrl+Shift+Enter.

+ 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 Values based on Column
    By raw_geek in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-15-2014, 01:55 PM
  2. Count Unique values in Column based on values in other columns
    By dmschave in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2014, 11:06 AM
  3. Count Unique Values based on another column
    By Ineedhelp12 in forum Excel General
    Replies: 2
    Last Post: 07-02-2009, 06:12 PM
  4. Count unique values based on another column
    By verdugan in forum Excel General
    Replies: 4
    Last Post: 07-02-2009, 12:21 PM
  5. Replies: 6
    Last Post: 03-31-2009, 11:17 AM

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