Gene Barrett
Gene Barrett

Reputation: 173

Count number of cells in a range that match the content of a different cell

I am trying to use COUNTIF in Excel to find how many items in a range match the contents of a separate cell. The idea is, the range contains everyone's answers to a given question (a one-word, non-numeric answer); the comparison column contains the correct answer. I want a count of how many people got the answer correct.

I tried: =COUNTIF(C16:BT16,"=BU16")

But it appears COUNTIF won't let me reference a cell with the criteria in it -- it requires the match criteria directly in the formula, such as =COUNTIF(C16:BT16,"DEN"). I can do that, of course, but I'd have to edit dozens of formulas every time I evaluate answers, and it would be much less timeconsuming if I could just enter the answers in column BU.

I also tried COUNTIFS; it allows multiple criteria, but also doesn't allow referencing the criteria to a different cell. Searched several different Excel websites too, any suggestions? Many thanks!

Upvotes: 17

Views: 98099

Answers (3)

Rodrigo Guedes
Rodrigo Guedes

Reputation: 1175

Try this:

=COUNTIF(C16:BT16;BU18)

Please note that you may need to use ";" instead of "," depending on your region.

Upvotes: 3

bonCodigo
bonCodigo

Reputation: 14361

  • If you are using Excel 2010, you are even luckier with COUNTIFS

  • By all means you may use the search range and matching range within countif

    e.g. =COUNTIF(SEARCH RANGE, CRITERIA RANGE)

Upvotes: 1

RocketDonkey
RocketDonkey

Reputation: 37249

Try removing the quotes and equal sign from "=BU18" - that will indicate that you are passing the value at that cell, which I believe is what you're looking for.

=COUNTIF(C16:BT16,BU18)

Assuming BU18 contains DEN. Your first example ("=BU18") is saying "count if any of these cells have a value of "=BU18", which won't match anything (unless they answered some weird questions :) ).

Upvotes: 18

Related Questions