Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Oct 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

COUNTIFS lets you specify several criterias.

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

share|improve this answer

You can do this with SUMPRODUCT even in Excel 2003 and earlier versions, e.g.


share|improve this answer

You must log in to answer this question.