Formula that will count the # of rows that contain a specific text and a specific month?

OodaLoop

New Member
Joined
Feb 16, 2013
Messages
6
I'm trying to come up with a count formula to meet my needs.


I want the formula to count each row in a sheet that meets two requirements.



  1. A cell in a certain column contains a specific text.
  2. A cell in a certain column falls within a specific month, the cell is currently in the mm/dd/yyyy format.



Here is an example of how the table looks:


TitleLevelDate
WaterCritical1/2/13
PowerHigh1/15/13
PowerHigh1/15/13
FilterLow1/30/13
HeatHigh2/5/13
DuctsLow2/15/13
LockLow2/15/13
WindowLow2/15/13

<tbody>
</tbody>




I have this formula for counting how many rows fall in a specific month:
Code:
=SUMPRODUCT(--(C$2:C$1048576<>""),--(MONTH(C$2:C$1048576)=1))


And I have this formula for counting how many rows contain a specific text (Level)
Code:
=COUNTIF(B2:B1048576, "High")


I need to combine them somehow. Not sure if it is possible to combine these two exact methods but I need something that lets me count the rows that are of a specific month and of a specific level.


Thanks for any help everyone.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I think you are probably looking for this formula...

=SUMPRODUCT(--(B2:B1048576="High"),--(MONTH(C2:C1048576)=1))

but I would recommend reducing the 1048576 row numbers to a lower value that will still handle your current and anticipated future needs (the formula will be more efficient if you do so).
 
Upvote 0
In the mean time...

Rich (BB code):
Rich (BB code):
Rich (BB code):
Rich (BB code):
=SUMPRODUCT(--(C$2:C$1048576<>"")*(--(MONTH(C$2:C$1048576)=1))*(--($B$2:$B$1048576="High")))
<tbody> </tbody>

<tbody>
</tbody>
 
Upvote 0
Hi and welcome to the forum,

Perhaps add a third array in your SUMPRODUCT like this:
Code:
=SUMPRODUCT(
    --(C2:C1048576 <> ""),
    --(MONTH(C2:C1048576) = 1),
    --(B2:B1048576 = "High"))
I think the first array in the SUMPRODUCT is still useful as otherwise an empty cell will be considered as January.

As per Rick's post, you should probably use a smart table or dynamic named ranges:
Working with Tables in Excel 2013, 2010 and 2007
Excel Names -- Excel Named Ranges

Alternatively you could have a seperate column that identifies the MONTH and then use the faster COUNTIFS function.
 
Upvote 0
Perhaps add a third array in your SUMPRODUCT like this:
Code:
=SUMPRODUCT(
    --(C2:C1048576 <> ""),
    --(MONTH(C2:C1048576) = 1),
    --(B2:B1048576 = "High"))
I think the first array in the SUMPRODUCT is still useful as otherwise an empty cell will be considered as January.
Good point (assuming the data really does have blank cells within it).
 
Upvote 0
Oh using a table to do it was a great idea. I don't know why I didn't think of that! Trying to figure out now, how to group by month... would that be even possible?
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

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