+ Reply to Thread
Results 1 to 13 of 13

Count one column based on values in another

  1. #1
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Count one column based on values in another

    So I have one coulumn with just 1s and 2s, 1s representing men and 2s representing woman. In my second column I have a bunch of numbers which are responses to a survey. The second column shows the respones from both men and woman. I want to count just how many men responded to this survey, however I dont know how to count only the mens responses from coulumn 2..

    Any help much appreciated!

  2. #2
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    What do you wnat to count - how many men responded or the total count from column 2 including only men?

    Basically if you want to count how many men responded, just do =COUNTIF(A7:A12,1) and this will give you the number of men who responded.

  3. #3
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    If you want to total the responses just by men you would do: =SUMIF(A7:A12,1,B7:B12) where A is the 1 or 2 and B is the range where the numbers are that correspond to the values.

  4. #4
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Re: Count one column based on values in another

    How many men responded. Which i guess is the same as the total count from column 2 including only men? Coulumn to has respones from both men and woman, i want to count how many of those responses are from men..

  5. #5
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    Use this: =COUNTIF(A:A,1) and count off your first column where man is 1 and woman is 2. That will give you the total amount of men responding. Sorry should be the whole column if there is no total. If there is a total, make the range of column A only where you have data.

  6. #6
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Re: Count one column based on values in another

    So there are actually several columns that I also needs to count the number of responses from men in. And the problem is that every man did not answer for every question. One man maybe has answered question in columns 2,3 and 5, but left 4 blank...

  7. #7
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    Do you have an example? How many columns? Also, what constitutes a count - if someone answers 2 of the 3 questions, does that count? Not a hard problem to solve but it's not clear exactly what "counts".

  8. #8
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Re: Count one column based on values in another

    Allright, so the question basically is how many number of responses by male respondents are there in column 1? Column 2? Column 3? Etc.
    GEN is the gender column, where 1s represent men.

    GEN C 1 C 2 C 3 C 4 C 5 C 6

    2 3 4 3 2 3 2
    1 3 3 3 1 2 2
    2 4 3 4 2 3 4
    1 3 2 2 2 3
    2 2 2 2 2 1
    2 3 1 3 1 4
    1 2 2 2 2 2 2
    1 3 3 1 2 1
    2 4 3 4 1 4 1
    2 5 4 5 3 2 5
    2 3 3 3 5 3
    2 2 1 3 4 2
    1 4 4 4 4
    2 4 4 4 1
    2 3 3 4 3 4 3
    1 1 2 1 3 1
    1 2 1 2 1
    1 1 1 1 1 1
    1 3 4 3 1 1
    2 3 1 3 1 1 1
    2 5 1 4 1 2 1


    Sorry, I'm really bad at explaining....

    Edit: okay so that got messed up once i posted it.. Idont know if you can still understand it?

  9. #9
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    So you want to count the number of responses in each column that are men, and when its blank in that column it doesn't count as a response by a man, correct?

  10. #10
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Re: Count one column based on values in another

    Yess, thats exactly right

  11. #11
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    Easy! Pretend your data is between rows 7 and 12, and your Gender Data is in Column C. Put this under your first column with responses (column D) then pull across:
    =COUNTIFS($C$7:$C$12,1,D7:D12,"<>"&"")

    Obviously change the 7 and 12 to whatever rows have data and you should be set! Give me some rep if I helped .

  12. #12
    Registered User
    Join Date
    09-16-2014
    Location
    U.S
    MS-Off Ver
    2010
    Posts
    9

    Re: Count one column based on values in another

    Aaah it worked! Yay! Haha thankyou so much. Sorry for my bad explantation! Can i ask what the "&" sign in the formula means?

  13. #13
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Count one column based on values in another

    Absolutely. & in Excel is the Concatenation operator in Excel. Let's say, for example, that you want to put two things together, like Peach and h. You could write the formula ="Peach"&"h". Try it. You'll see you get Peachh. You can substitute Cell references too. Tryp putting the Peach in A1 and h in A2, and in A3 typing =A1&A2 . Basically what I said what - count my column by 1 increment everytime I 1) See a 1 representing a male and 2) in my current column, the value is not equal to blank. Unfortunately, to make the <> work you have to put it into quotes since it's not a reference. So I basically wrote the line by line formula of C<>blank, or C is not equal to blank. Make sense?

+ 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. Replies: 7
    Last Post: 01-29-2015, 10:14 AM
  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. How to count number of values in one column based on another column value?
    By Howard Gale in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 01-16-2013, 07:15 PM
  4. Replies: 3
    Last Post: 06-10-2010, 11:54 AM
  5. Count Values in Column B based on Criteria in Column A
    By brughel in forum Excel General
    Replies: 5
    Last Post: 04-17-2009, 02:30 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