+ Reply to Thread
Results 1 to 8 of 8

How to count the number of people in two different columns

  1. #1
    Registered User
    Join Date
    11-27-2019
    Location
    Christchurch, NZ
    MS-Off Ver
    16
    Posts
    3

    How to count the number of people in two different columns

    Hey everyone,

    Hoping someone can help me.

    Im trying to count the number of people in two different columns.
    I dont really care who has each one, just how many.

    For example how many people have both A & B or C & F

    Data set is quite large 2500 columns by 1500 rows, so lots of pairs to count.

    Each column has a header (name of item), each row has a name and if they have the item a 1 is placed in that column.


    Any help would be great, thanks
    Attached Files Attached Files
    Last edited by Croprock; 11-27-2019 at 10:28 PM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,502

    Re: How to count the number of people in two different columns

    not sure I follow what you want and what you posted.
    for example, you have Dave in row 2 and a 1 under the header B and a 1 under the header D but in columns K and L you have A and B. Shouldn't it be B and D?
    And what result do you want for Dave (and others)? You say you have 2500 columns, that is a wide workbook. Couldn't a simple sum be used at the end of the row that would show how many have a 2 or more showing they are in two or more columns?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    11-27-2019
    Location
    Christchurch, NZ
    MS-Off Ver
    16
    Posts
    3

    Re: How to count the number of people in two different columns

    Hey,

    The columns K & L were just examples, there are hundreds of pairs that I need to match.

    I need to know how many people have both B & D, all figures are a 1 as no one has more than 1, so a sum function doesn't help.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: How to count the number of people in two different columns

    Start with:
    Please Login or Register  to view this content.
    Ben Van Johnson

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,502

    Re: How to count the number of people in two different columns

    a sum function would tell you if the person is in more than one column. So for Dave it would be 2 which, based so far on what you've written that sounds like what you want.
    that is why I mentioned providing some examples of the output you expect.

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,502

    Re: How to count the number of people in two different columns

    Looks like Ben figured it out so that is good. It would be interesting to see that formula applied to 2500 columns but glad you (hopefully) got an answer.

  7. #7
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: How to count the number of people in two different columns

    Hi,
    If you are looking to add how may times number of people are enrolled in BOTH A AND B try
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Similarly, for C&F
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is an array formula, Press Ctrl+Shift+Enter.

    When you press Ctrl+Shift+Enter, Excel automatically inserts the formula between { } (a pair of opening and closing braces).
    Attached Files Attached Files
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  8. #8
    Registered User
    Join Date
    11-27-2019
    Location
    Christchurch, NZ
    MS-Off Ver
    16
    Posts
    3

    Re: How to count the number of people in two different columns

    Tried =SUMPRODUCT(--(INDEX($B$2:$G$11,0,MATCH(K2,$B$1:$G$1,0))=1),--(INDEX($B$2:$G$11,0,MATCH(L2,$B$1:$G$1,0))=1))

    Changed it to fit my workbook and boom town!

    Ben, you are a legend!

+ 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] Need help on repeating values in columns based on the table people count
    By elayaz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-13-2016, 08:32 AM
  2. Replies: 3
    Last Post: 05-08-2015, 12:05 PM
  3. Count the number of people per classification between two dates
    By Philipdjhd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-21-2014, 01:08 AM
  4. How do I count the number of people needed on a project over various days?
    By seppopovich in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2013, 09:22 AM
  5. I need to count the number of people who work before a certain time.
    By nickmessick1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-15-2012, 04:02 PM
  6. How to count number of people per time interval
    By chinkygirl in forum Excel General
    Replies: 1
    Last Post: 02-11-2012, 01:33 PM
  7. Sumproduct-count the number of people
    By Zippy2005 in forum Excel General
    Replies: 3
    Last Post: 04-19-2007, 02:49 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