Using SPILL Array in Countif

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,197
Office Version
  1. 365
Platform
  1. Windows
I'm trying to count the number of dates that fall into another set of dates. I could create a series of if statements to get the job done, but I'm trying to create and learn something new.

I want to use Countif with Sequence. It does work:
=SUM(COUNTIF(L3#,J11#))
Cell J11: =SEQUENCE(,I8-H8,H8,1)
Cell L3: =SEQUENCE(,M4-L4,L4,1)

I get the correct return if the Sequence SPILL is not overlapped by any other cells. How do I turn the Sequence SPILL into an Array that Countif can use?

Jeff
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
what is in cells L4 thru M4, and I8 thru H8?
 
Upvote 0
I just made a guess as to what your date ranges are.
But, try this:

Mr excel questions 58.xlsm
HIJKLMNOPQRSTUV
12
2
32023-09-012023-09-022023-09-032023-09-042023-09-052023-09-062023-09-072023-09-082023-09-092023-09-102023-09-11
42023-09-012023-09-12
5
6
7
82023-09-102023-09-15
9
10
112023/09/102023/09/112023/09/122023/09/132023/09/14
Jeffrey Mahoney
Cell Formulas
RangeFormula
I1I1=SUM(--NOT(ISNA(MATCH(J11#,L3#,0))))
L3:V3L3=SEQUENCE(,M4-L4,L4,1)
J11:N11J11=SEQUENCE(,I8-H8,H8,1)
Dynamic array formulas.
 
Upvote 0
Here is my range. I need to convey to what exactly the need is. The formulas I gave above worked, but only if the SPILL array wasn't blocked. If the formulas with Sequence are blocked to the right, it doesn't work.

I need to find a way to convert the sequence array from a SPILL result to an ARRAY result that I can use in the Countif.

I tried several things: TextSplit, TextJoin, ArraytoText

Countif and Sequence.xlsm
GHIJKLMN
4Task DurationStart DateDue Date8/14/20238/21/20238/28/20239/4/2023
538/21/20238/24/2023#SPILL! X  
618/23/20238/24/2023 X  
7108/21/20238/31/2023 XX 
8208/26/20239/15/2023#SPILL! 2
94516445184   
10   
1145164###451664516745168
Sheet16
Cell Formulas
RangeFormula
L4:N4M4=L4+7
K5:K10,M9:N10,L5:N7M5=IF(OR(AND($H5>=M$4,$H5<M$4+7),AND($I5>=M$4,$I5<M$4+7)),"X","")
J5J5=SEQUENCE(,I5-H5,H2,1)
H5:H8H5=I5-G5
J8,J11:AC11J8=SEQUENCE(,I5-H5,H5,1)
L8L8=SUM(COUNTIF(L3#,J11#))
H9:I9H9=H8
 
Upvote 0
I dont understand your worksheet at all. But, I think you are asking for a formula in cell L8. But, I really cannot tell.
This is what I have come up with: (I had to change some of the values in the column G to get an value.

Mr excel questions 58.xlsm
GHIJKLMN
1
2
3
4Task DurationStart DateDue Date2023/08/142023/08/212023/08/282023/09/04
5102023-08-142023-08-24XX  
612023-08-232023-08-24 X  
7102023-08-212023-08-31 XX 
8252023-08-212023-09-15 3
92023-08-212023-09-15   
Jeffrey Mahoney
Cell Formulas
RangeFormula
L4:N4M4=L4+7
M9:N9,K5:K9,L5:N7M5=IF(OR(AND($H5>=M$4,$H5<M$4+7),AND($I5>=M$4,$I5<M$4+7)),"X","")
H5:H8H5=I5-G5
L8L8=SUM(--NOT(ISNA(MATCH(SEQUENCE(,I5-H5,H5,1),SEQUENCE(,I8-H8,H8,1),0))))
H9:I9H9=H8
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,696
Members
452,938
Latest member
babeneker

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