+ Reply to Thread
Results 1 to 3 of 3

Count unique values in one column based on conditions and unique values in another column

  1. #1
    Registered User
    Join Date
    01-11-2013
    Location
    Virginia, United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Count unique values in one column based on conditions and unique values in another column

    I have a countif conundrum. I have a sheet of data as shown below. I need to count the number of Food Groups where a specific Name has eaten at least one piece of Food of each unique type of Food listed for that Name in that Food Group.

    For example, Jane had three pieces of fruit she could have eaten (two that were unique). She ate both unique types, so Fruit would count as 1. She also had two unique Vegetables, but only ate 1, so vegetable would not count. Jane's count is 1 food group.

    Bob had one unique fruit he could have eaten and 1 unique meat he could have eaten and he ate both. The count for Bob would be 2 food groups.

    Is it possible to have a formula that will return a Food Group count for Jane?

    Name | Food Group | Food | Eaten? |
    Jane Fruit Apple Yes
    Jane Fruit Apple No
    Jane Fruit Orange Yes
    Jane Vegetable Lettuce Yes
    Jane Vegetable Carrot No
    Bob Fruit Apple Yes
    Bob Meat Beef Yes

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Count unique values in one column based on conditions and unique values in another col

    Hi Margaret Anne,

    What you are asking is counter-intuitive. I don't understand why Jane doesn't get 2 for Fruit and 1 for vegetables.

    Regards,

    David

    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.

    If this has been of assistance, please advise.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  3. #3
    Registered User
    Join Date
    01-11-2013
    Location
    Virginia, United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Count unique values in one column based on conditions and unique values in another col

    Hi David,

    Thanks for responding. The counter is for Food Group, not Food. Jane only gets a +1 count for a food group if she ate at least one piece of each unique type of food from that food group that she could have eaten. So she gets a +1 for the Fruit food group, since she ate one apple and one orange and there were no other unique fruits she could have eaten. She does NOT get a plus one for Vegetable, because she only ate one of the two unique vegetables.

    Bob gets a +1 for meat and a +1 for fruit because he only had one unique meat and one unique fruit and he ate both.

    Does that make more sense?

    Margaret

+ 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. [SOLVED] Count unique text values within a range based on another column
    By Sebastes in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-14-2014, 01:38 PM
  3. 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
  4. Count Unique Values In One Column Basis Unique Values in Another Column
    By shez_raz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2012, 01:55 AM
  5. Replies: 11
    Last Post: 11-05-2011, 12:34 PM
  6. Count Unique Values based on another column
    By Ineedhelp12 in forum Excel General
    Replies: 2
    Last Post: 07-02-2009, 06:12 PM
  7. Count unique values based on another column
    By verdugan in forum Excel General
    Replies: 4
    Last Post: 07-02-2009, 12:21 PM

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