google-sheetsgoogle-sheets-formula

Split cell with dates and find matching dates on headers


I have a dataset that looks like this:

enter image description here

I put together a shared sheet here.

The formula currently in column E works like this... Count IF:

Here is the current formula:

=BYROW(FILTER(ARRAYFORMULA(IF(ARRAYFORMULA(IF((F1:O1>=A2:A)*(F1:O1<=B2:B),INDEX(F2:O,0)))="Yes",1,0)),A2:A<>""), LAMBDA(x, SUM(x)))

This works great, but what I need to add is a check on column D and increase count IF:

Column C has the expected outcome. I prefer to have one formula fill down the whole column as that will be dynamic. Bonus would be to make this dynamic for columns F and beyond as that will also grow.

Please let me know if there is any other information needed so I can update this post.


Solution

  • You may try:

    =byrow(F2:O,lambda(Σ,if(counta(Σ)=0,,let(Γ,F1:O1,Δ,lambda(x,index(x,row(Σ))),Ξ,lambda(x,y,filter(x,isbetween(y,Δ(A:A),Δ(B:B)))),Λ,split(Δ(D:D),", ",),
     countif(Ξ(Σ,Γ),"Yes")+countif(sort(xlookup(Ξ(Λ,Λ),Γ,Σ,)),"No")))))
    

    enter image description here