'How do I use a query to get a date from an array formula?

On sheets, I'm using this formula to sum hours to a specific month from a drop-down menu.

=QUERY('Form responses 1'!H2:L, 
"Select L, Sum(K) 
WHERE L is not NULL 
AND L >= date """&TEXT(C2, "yyyy-MM-dd")&""" 
AND L <= date """&TEXT(C3, "yyyy-MM-dd")&""" 
Group By L LABEL L 'Month', Sum(K) 'Total Hours'")

However, on another sheet, I have L (Month) using:

=IF(A2="",,(DATE(YEAR(E2), MONTH(E2), 1)))

I would like to use an array function such as this

={"Date Completed"; Arrayformula(IF(E2:E="",, TEXT( INT(E2:E), "MMM YYYY" ))) }

If I use the arrayformula, my initial Query formula doesn't work, and it leaves everything blank. No error code. I used an array formula to automate the Month and Year since the data is populated from survey responses.



Solution 1:[1]

in L1 try:

={""; ARRAYFORMULA(IF(A2:A="",,DATE(YEAR(E2:E), MONTH(E2:E), 1)))}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0