Countifs

JOEE1979

Active Member
Joined
Dec 18, 2022
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Cell (C4) has formula
Excel Formula:
=COUNTIFS(I7:I7326, MONTH($L$1) = MONTH(I7:I7326), C7:C7326,"YES")
Cell (L1)
Excel Formula:
=TODAY()

Not sure why I am getting "SPILL!"

Schedule 4 Tracker - Copy12313.xlsx
CDEFGHI
7YESOSH1-Jan-2431-Oct-241-Nov-24
2024
Cell Formulas
RangeFormula
G7G7=A7
Cells with Data Validation
CellAllowCriteria
C7:D7326ListYES
E7:E7320ListPMA, UNDER
F7:F7320ListOSH, STVL, SRK, EG
H7:I7List='Current Month'!$AL$26:$AL$29
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
You're getting #SPILL! because criteria1 in your COUNTIFS is an array.

COUNTIFS is the wrong function to use here, as it will only accept range arguments: criteria_range1, criteria_range2 etc.

One option you could use instead: =SUM((MONTH(I7:I7326)=MONTH(L1))*(C7:C7326="YES"))
 
Upvote 0
You're getting #SPILL! because criteria1 in your COUNTIFS is an array.

COUNTIFS is the wrong function to use here, as it will only accept range arguments: criteria_range1, criteria_range2 etc.

One option you could use instead: =SUM((MONTH(I7:I7326)=MONTH(L1))*(C7:C7326="YES"))
That worked, however I needed to go a bit further and make it into weekly, so I replaced MONTH with WEEKNUM, but it gave me a value error
 
Upvote 0
Try changing this part of the formula:
Excel Formula:
WEEKNUM($I7:$I7326)
to
Excel Formula:
WEEKNUM(--$I7:$I7326)

The double unary (--) is one way in Excel to coerce values to numeric (you could also add 0, or multiply by 1).

It shouldn't be necessary here, as the input is already numeric. It's just a quirk of this function (and others like EDATE and EOMONTH) that this is what you need to do to make it work.
 
Upvote 0
Solution
Try changing this part of the formula:
Excel Formula:
WEEKNUM($I7:$I7326)
to
Excel Formula:
WEEKNUM(--$I7:$I7326)

The double unary (--) is one way in Excel to coerce values to numeric (you could also add 0, or multiply by 1).

It shouldn't be necessary here, as the input is already numeric. It's just a quirk of this function (and others like EDATE and EOMONTH) that this is what you need to do to make it work.
Worked, Thanks
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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