# Count cells equal to a value within a date range

#### margamo

##### New Member
Can some help me with this array formula:
{=SUM(DrugClass="HS051")*(OrderDate>=T4)*(OrderDate<T5)} I want to check for DrugClass equal to HS051 and then check if the OderDate is within a certain date range.

Any help would be greatly appreciated.
Thanks,
margamo

### Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Somehow the formula didn't copy right it should be:
{=SUM(DrugClass="HS051")*(OrderDate>=T4)*(OrderDate
<T5)}

Try clicking the Code button before and after inserting your formula. It's the < sign that is messing it up. I learned this myself recently.

Try checking the "Disable HTML in this post" button.

Code:
``{=SUM(DrugClass="HS051")*(OrderDate>=T4)*(OrderDate < T5)}]``

Hi,

Like this?

If you use SUMPRODUCT you do not need to array enter.
Book1
NOPQRSTU
1
2HS0492005-10-07
3HS0502005-10-08
4HS0512005-10-0922005-10-10
5HS0512005-10-102005-11-10
6HS0512005-10-11
7HS0522005-10-12
8HS0532005-10-13
9HS0542005-10-14
10HS0552005-10-15
11
Sheet1

Thanks a lot: it worked great!
Margamo

Replies
4
Views
413
Replies
5
Views
166
Replies
1
Views
140
Replies
2
Views
276
Replies
6
Views
157

1,203,104
Messages
6,053,543
Members
444,670
Latest member
laurenmjones1111

### 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.

### Which adblocker are you using?

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

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