Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 511
Gene Barrett Avatar asked Dec 20 '12 18:12

Gene Barrett


People also ask

How do you count the number of cells that match another cell?

The COUNTIF function in Excel counts the number of cells in a range that match one supplied condition. Criteria can include logical operators (>,<,<>,=) and wildcards (*,?) for partial matching. Criteria can also be based on a value from another cell, as explained below.

How do I use match and Countif together?

COUNTIFS function COUNTIFS can be used with criteria based on dates, numbers, text, and other conditions. COUNTIFS supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching. This time, COUNTIFS returns 1, since there is just one "red" order over 15.

How do I count cells with text matching in Excel?

Count the number of cells with specific text Select a blank cell for displaying the result. Then copy and paste the formula =COUNTIF($A$2:$A$10,"Linda") into the Formula Bar, and press the Enter key on the keyboard. Then you will see the result displaying in the selected cell.


1 Answers

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 :) ).

like image 51
RocketDonkey Avatar answered Oct 19 '22 03:10

RocketDonkey