+ Reply to Thread
Results 1 to 5 of 5

Count number of group members

  1. #1
    Registered User
    Join Date
    02-12-2010
    Location
    NY
    MS-Off Ver
    Excel 2019
    Posts
    47

    Count number of group members

    Hello and Happy New Year to all!

    I dont have access to Excel on this machine so I'll try to explain without it. Please bear with me

    On Sheet1, I have 2columns: a list of unique items and group they belong to:

    Item: Group
    Item1 1
    Item2 1
    Item3 1
    Item10 2
    Item25 2
    Item155 3

    Again, all item names are unique.

    On Sheet2 in column A, I have a random list of Items from column A above.

    What I need to do is to figure out how many items from each group are on that list and get that number in column B of sheet2

    I know how to do it in 2 steps, but I'm trying to figure it out how to do it in one step.

    Here is how I do it now:

    In column B of sheet2, I figure out what group the item belongs to: =sumif(sheet1!CoulmnA:A,A1,sheet1!CoulmnB:B)
    In column C of sheet2, I count number of appearances in column B: =countIf(ColumnB:B,B1)

    So I guess my quiestion is: how do I combine two formulas above into one.

    Thank you so much in advance for you help! Please let me know if any of this is unclear.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count number of group members

    see. your C1 formula is:
    =countIf(ColumnB:B,B1)

    you are using B1. so just combine what you got in B1:
    =COUNTIF(Sheet1!B:B,SUMIF(Sheet1!A:A,A1,Sheet1!B:B))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    02-12-2010
    Location
    NY
    MS-Off Ver
    Excel 2019
    Posts
    47

    Re: Count number of group members

    Thank you for replying, benishiryo!

    Unfortunately, that's not exactly what I need. I'm attaching the actual file this time. Sorry for confusion.

    Column A is a list of uniquely named factors
    Column B is a group each factor belongs to (I color coded each group)

    Column F contains random list of factors, all exist in column A.
    I need to identify which factors in column F is a lonely representative of its group (column B)
    I achieve that now in 2 steps as you will see in columns G and H.
    I highlighted red 2 rows that I need to identify.

    So my question is: how do I achieve what I'm doing now in 2 steps (Column G and H) in one step.

    Please let me know if this is clearer now.

    Thanks!!!
    Attached Files Attached Files

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count number of group members

    maybe:
    =SUMPRODUCT(--(SUMIF(A:A,$F$2:$F$15,B:B)=SUMIF(A:A,F2,B:B)))

    you can even go further with conditional formatting to highlight those that are lone representatives and omit using the formula. select the range you want to apply to (say from F2:F15)
    go to Home tab -> Conditional Formatting -> New Rule -> Use a formula to determine which cells to format -> Format values where this formula is true:
    =SUMPRODUCT(--(SUMIF(A:A,$F$2:$F$15,B:B)=SUMIF(A:A,F2,B:B)))=1
    format color

  5. #5
    Registered User
    Join Date
    02-12-2010
    Location
    NY
    MS-Off Ver
    Excel 2019
    Posts
    47

    Re: Count number of group members

    Brilliant! Just brilliant! Thank you so much!

+ 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. Total of some members of main group
    By Navin Agrawal in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-26-2015, 01:46 PM
  2. Randomize the Members of a Group
    By MDNerey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2013, 07:04 PM
  3. [SOLVED] Convert Object Members to Group Based on Number ID
    By fara.rhea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2013, 11:52 AM
  4. count the number of members in cells seperated by ;
    By wali in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2008, 01:46 PM
  5. Replies: 0
    Last Post: 11-18-2007, 07:24 PM
  6. [SOLVED] Importing AD particular group members to Excel 2003
    By François Racine in forum Excel General
    Replies: 2
    Last Post: 05-07-2006, 01:20 PM
  7. [SOLVED] A thank-you note to Excel and PPT group members
    By Hari in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 10-13-2005, 09:05 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