# Comparing 2 columns to result in a count total

We have 4 conference weeks a year. Some people who come, have come the year before. How do I calculate how many people have come the year before?

``````Session Pref 1               Attended Before
(2) June 24 - 28, 2013       No
(1) June 17 - 21, 2013       Yes
(1) June 17 - 21, 2013       No
(3) July 8 - 12, 2013        No
(3) July 8 - 12, 2013        Yes
(2) June 24 - 28, 2013       No
(2) June 24 - 28, 2013       No
(1) June 17 - 21, 2013       No
``````

Thank you!

-
For the example you have in your question, what is the sum you are expecting to get and how would you calculate it? – Jerry Sep 23 '13 at 12:44

``````awk '{if(\$7=="Yes") s+=1;} END {print s}' test.txt
``````

Use awk for counting the Yes-entries and sum it up!

-
I presume the OP is looking for a solution in Excel, given that the question is tagged microsoft-excel-2010. – John Bensin Sep 23 '13 at 13:15

Let's say your columns are A and B. If you just want the total number of people who are marked "Yes" in column B, use the following:

``````=countif(B:B, "Yes")
``````

If you want the number of "Yes" answers for a given session, use the following:

``````=countifs(A:A, "(1) June 17 - 21, 2013", B:B, "Yes")
``````

You probably want cell references instead, so that it's easier to change:

``````=countifs(A:A, C1, B:B, D1)
``````
-