Counting two variables

stephensm

New Member
Joined
Jun 19, 2008
Messages
11
Hi,

I am trying to create a count based on two variables - site status and activation date - for an output of "# of sites activated this month." Column C is "Site Status" and Column D is "Activation Date." My current formula...

{=COUNT(IF(MONTH($D$16:$D$999)=MONTH('Study Summary'!$E$17), 1))}

...is "working" but is only accounting for one variable and so it is also counting sites that have been deactivated this month. I'm struggling to get the current month, driven by 'Study Summary!$E$17, inserted into a formula. Any help would be very much appreciated. Thanks.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to the board...

Try this

=SUMPRODUCT(--(MONTH($D$16:$D$999)=MONTH('Study Summary'!$E$17)),--(MONTH($C$16:$C$999)="Active"))

Hope this helps.
 
Upvote 0
=SUMPRODUCT(--($C$16:$C$999="Active"),
--(MONTH($D$16:$D$999)=MONTH('Study Summary'!$E$17)))
 
Upvote 0
Try...

=SUMPRODUCT(--(StatusRange=X2),--(DateRange-DAY(DateRange)+1=Y2))

where X2 houses a status value and Y2 a first day date like 1-Feb-08.
 
Upvote 0
Thanks all but I'm getting #Value! errors for each of the formulas even when I put them in as array formulas. Where did I go wrong?
 
Upvote 0
Thanks jonmo1. I thought about that and so I copied your formula directly into the cell. Still no luck....

=SUMPRODUCT(--(MONTH($D$16:$D$999)=MONTH('Study Summary'!$E$17)),--($C$16:$C$999)="Active")

Should I be inserting something in place of the --?
 
Upvote 0
Thanks jonmo1. I thought about that and so I copied your formula directly into the cell. Still no luck....

=SUMPRODUCT(--(MONTH($D$16:$D$999)=MONTH('Study Summary'!$E$17)),--($C$16:$C$999)="Active")

What is the value in 'Study Summary'!$E$17?

What is the name of the sheet you invoke this formula from within?

What is the result of

=ISNUMBER(D16)

Should I be inserting something in place of the --?

No...
 
Upvote 0
Aladin, 'Study Summary'!$E$17 is today's date ("today()"). ISNUMBER(D16) = True. I appreciate your help.
 
Upvote 0
Aladin, 'Study Summary'!$E$17 is today's date ("today()"). ISNUMBER(D16) = True. I appreciate your help.
Code:
=SUMPRODUCT(
   --($C$16:$C$999)="Active"),
   --($D$16:$D$999-DAY($D$16:$D$999)+1=
         'Study Summary'!$E$17-DAY('Study Summary'!$E$17)+1))
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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