clhendricksbc
New Member
Hello:
First off, let me say a great, big, huge thank you to everyone involved in this site! What a fantastic resource it is, and I really appreciate the time taken by those who are willing to answer questions on the forum.
I am rather a newbie to excel, having mastered very simple formulas, and now happy to have figured out COUNTIF and COUNTIFS. I have yet to master the venerable SUMPRODUCT, and I don't know if it's relevant here.
I have searched quite a bit on the web and on this site for an answer to my question, and I apologize it is somewhere that I haven't seen. It's quite possible I'm searching on the wrong terms or looking in the wrong places.
I have done a survey that has open-ended questions, where people answer with sentences. There are five questions, and the answers to each are in a column in excel (I am using Excel 2008 for Mac). For each answer, I am assigning codes to capture similarities in answers. For example, if someone says they liked a class because it helped them make friends in university, I give that answer the code "FRND." If someone says that the classroom developed a good, close, community feel, I give it the code "COMMUN." Each answer can have several codes attached to it.
I have set up a column next to each question for the codes. So, next to the column of answers for Question 3, I have inserted a new column that I have named "Q3Answrs." Each cell of Q3Answrs has the codes for the corresponding answer in the column next to it, same row. In each cell of Q3Answrs there can be several codes, such as: FRND, WRIT, COMMUN, PROF, etc.
Now, I want to do two things, one of which I have already figured out.
1. I want to count how many times a code occurs in the column Q3Answrs, such as FRND. I have used COUNTIF for this:
=COUNTIF(Q3Answrs, "*FRND*")
I used asterisks around FRND so that the cell would be counted even if FRND had other things around it (so, e.g., if the cell had WRIT, FRND, PROF, then it would still be counted). So I've got this task done.
2. I also want to count how many cells there are that contain either or both of two codes (or three, or four...). For example, I'd like to count how many cells there are that contain FRND or COMMUN or both. But, I'd like to count each cell ONLY ONCE, even if it contains both of those codes.
I've tried two things, neither of which works. First, I tried COUNTIFS:
=COUNTIFS(Q3Answrs,"*FRND*",Q3Answrs,"*COMMUN*")
That gave me how many cells have both of those codes, but I want to know how many have either or both.
I've also tried two COUNTIF functions:
=COUNTIF(Q3Answrs, "*FRND*")+COUNTIF(Q3Answrs, "*COMMUN*")
That gave me how many cells had either or both, but it counted cells that had both twice. I want to just count them one time. I could explain why, but it would make this long post even longer. Just ask if you want to know/if it's relevant.
Now, I probably should have set it up so that each cell has only one code, and the codes are in several columns. But as I have 20 or more codes, I wanted to avoid that if possible. If it's not possible to do what I want to do with the codes all in single cells separated by commas, well, then, so be it, and I will separate them into their own columns.
Thanks so much for any help anyone can offer.
First off, let me say a great, big, huge thank you to everyone involved in this site! What a fantastic resource it is, and I really appreciate the time taken by those who are willing to answer questions on the forum.
I am rather a newbie to excel, having mastered very simple formulas, and now happy to have figured out COUNTIF and COUNTIFS. I have yet to master the venerable SUMPRODUCT, and I don't know if it's relevant here.
I have searched quite a bit on the web and on this site for an answer to my question, and I apologize it is somewhere that I haven't seen. It's quite possible I'm searching on the wrong terms or looking in the wrong places.
I have done a survey that has open-ended questions, where people answer with sentences. There are five questions, and the answers to each are in a column in excel (I am using Excel 2008 for Mac). For each answer, I am assigning codes to capture similarities in answers. For example, if someone says they liked a class because it helped them make friends in university, I give that answer the code "FRND." If someone says that the classroom developed a good, close, community feel, I give it the code "COMMUN." Each answer can have several codes attached to it.
I have set up a column next to each question for the codes. So, next to the column of answers for Question 3, I have inserted a new column that I have named "Q3Answrs." Each cell of Q3Answrs has the codes for the corresponding answer in the column next to it, same row. In each cell of Q3Answrs there can be several codes, such as: FRND, WRIT, COMMUN, PROF, etc.
Now, I want to do two things, one of which I have already figured out.
1. I want to count how many times a code occurs in the column Q3Answrs, such as FRND. I have used COUNTIF for this:
=COUNTIF(Q3Answrs, "*FRND*")
I used asterisks around FRND so that the cell would be counted even if FRND had other things around it (so, e.g., if the cell had WRIT, FRND, PROF, then it would still be counted). So I've got this task done.
2. I also want to count how many cells there are that contain either or both of two codes (or three, or four...). For example, I'd like to count how many cells there are that contain FRND or COMMUN or both. But, I'd like to count each cell ONLY ONCE, even if it contains both of those codes.
I've tried two things, neither of which works. First, I tried COUNTIFS:
=COUNTIFS(Q3Answrs,"*FRND*",Q3Answrs,"*COMMUN*")
That gave me how many cells have both of those codes, but I want to know how many have either or both.
I've also tried two COUNTIF functions:
=COUNTIF(Q3Answrs, "*FRND*")+COUNTIF(Q3Answrs, "*COMMUN*")
That gave me how many cells had either or both, but it counted cells that had both twice. I want to just count them one time. I could explain why, but it would make this long post even longer. Just ask if you want to know/if it's relevant.
Now, I probably should have set it up so that each cell has only one code, and the codes are in several columns. But as I have 20 or more codes, I wanted to avoid that if possible. If it's not possible to do what I want to do with the codes all in single cells separated by commas, well, then, so be it, and I will separate them into their own columns.
Thanks so much for any help anyone can offer.