Excel - Counting text in multiple columns

GarysBeau

New Member
Joined
Jun 7, 2011
Messages
14
Hi apologies if this has been covered. Probably a simply query but I cant work it out.

Anyway

I have a range of text and I want to count them based on criteria from differing columns.

For example:

A--------B-------C
Blue----Apple-----
Blue----Apple-----
Yellow--Apple-----
Blue-----Pear------



So I want to count the amount of 'blue apples' (Dont know where you'd get blue apples mind) so it should return: 2
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
If using 2007 then CountIFs formula

Excel Workbook
ABCDE
1ColourFruitcountifs
2BlueAppleBlue Apples2
3BlueAppleYellow Apples1
4YellowAppleBlue Pear1
5BluePear
Sheet1
 
Upvote 0
If you have Excel 2003 or earlier
=SUMPRODUCT(--(A1:A10="Blue"),--(B1:B10="Apple"))

If you have Excel 2007 or later...
=COUNTIFS(A:A, "Blue", B:B, "Apple")
 
Upvote 0
One way to do this would be to put this formula in column C:

=A1&B1

Copy down as far as needed.

Then in cell D1 you could enter this formula to count for the first 5 rows:

=COUNTIF(C1:C5,A1&B1)
 
Upvote 0
Thanks everyone for your responses. I did forget to mention that its 2003 excel (Thats how our company rolls).

This leads me to my next question: How do I apply the same formula if there are several variations of 'blue', but I want to count them as 1 criteria

For example:

A-------------B-------C
Blue 2-------Apple-----
Blue 1-------Apple-----
Yellow-------Apple-----
Blue 999-----Pear------

That still returns '2'
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,843
Members
452,948
Latest member
UsmanAli786

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
Back
Top