Count cells that match?

meredithsegal

New Member
Joined
Oct 10, 2011
Messages
38
I have data in C2:C14 and D2:D14. I want Excel to count the number of instances in which the value in column C matches the value in that row in column D. What's the easiest way?

Thanks so much--you guys are always awesome!
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Awesome, why does it work tho?

Because I told it to.:LOL:


It creates an array of True or False results based on the expression C2:C14=D2:D14.
Evaluating each row 1 at a time, does C2 = D2 ? Does C3 = D3?
With a True or False result for each row

The -- converts those True/False results into 1/0 results (True = 1, False = 0)
Then it sums the results.
 

meredithsegal

New Member
Joined
Oct 10, 2011
Messages
38

ADVERTISEMENT

(and how can I amend it only to consider cells with a given value in column A -- how to add (countif(A2:A14,"apple"))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,630
Members
414,082
Latest member
sasmita

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top