# check two conditions in two different columns in excel and count the matches

I've trying to create a Error Log to help me analyse my mistakes. So for simplicity, lets assume I have two columns "Type of Question" - with values SC,RC,CR and another column that indicates whether I got this question "right/wrong".Let's assume this is my table:

Question No. | Right/Wrong | Question Type

1. | Right | SC

2. | Right | RC

3. | Wrong | SC

4. | Wrong | CR

5. | Right | RC

(Pardon my formatting skills).

And I want an output table like this

Type of Question | Right | Wrong | Total

SC | 1 | 1 | 2

RC | 2 | 0 | 2

CR | 0 | 1 | 1

So basically what I want to do is check Column3 for SC using =COUNTIF(C1:C5,"SC"), and return the total number of SC questions, and then outta the SC , I need to find out which are Right.If I know the right and the total I can get the wrong.

I have never written a macro so a formula based answer would suffice.

-

## migrated from stackoverflow.comOct 8 '12 at 2:45

This question came from our site for professional and enthusiast programmers.

If you are using excel 2007 or later look into `Countifs` –  chris neilsen Oct 7 '12 at 18:28

`=SUMPRODUCT((C1:C5="SC")*(B1:B5="Right"))`
In your case `=COUNTIFS(C1:C5;"SC";B1:B5;"Right")`