countif with two conditions

smithrd6

Board Regular
Joined
Dec 13, 2005
Messages
150
I have items which have different ages. For example, bread, donuts, begals with each having an age (days), some are 2 days old, others are over 6. I want to count the number of those items which are listed in the same column by age, i.e., bread less than 5 days, begals between 6 and 10 days. Will a countif will multiple criteria work?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I have items which have different ages. For example, bread, donuts, begals with each having an age (days), some are 2 days old, others are over 6. I want to count the number of those items which are listed in the same column by age, i.e., bread less than 5 days, begals between 6 and 10 days. Will a countif will multiple criteria work?

Counting all items with a certain age:

=COUNTIF(AgeRange,5)

Counting per item using a age criterion:

=SUMPRODUCT(--(ItemRange="bread"),--(AgeRange < 5))
 
Upvote 0
I have items which have different ages. For example, bread, donuts, begals with each having an age (days), some are 2 days old, others are over 6. I want to count the number of those items which are listed in the same column by age, i.e., bread less than 5 days, begals between 6 and 10 days. Will a countif will multiple criteria work?
What version of Excel are you using?
 
Upvote 0
=SUMPRODUCT(--(ItemRange="bread"),--(AgeRange < 5))
works.....

rather than <5, how to capture between two numbers, i.e. >5 and <10?
 
Upvote 0
If you are on Excel 2007 or later, try...

=COUNTIFS(ItemRange,"bread"),AgeRange,"<5")

Or with X2 = bread and Y2 = 5...

=COUNTIFS(ItemRange,X2),AgeRange,"<"&Y2)
 
Upvote 0
If you are on Excel 2007 or later, try...

=COUNTIFS(ItemRange,"bread"),AgeRange,"<5")

Or with X2 = bread and Y2 = 5...

=COUNTIFS(ItemRange,X2),AgeRange,"<"&Y2)
I think you have too many ")".

=COUNTIFS(ItemRange,X2,AgeRange,"<"&Y2)
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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