Search code examples
google-sheetsfiltertransposeflattengoogle-query-language

Display Upcoming Dates By This Week, Next Week and Next Month on a separate sheet


I am new to google sheets. I have a spreadsheet with all my data and im trying to build a dashboard for easy digestion for my team. Part of the data is keeping track of our filming dates for each client. From shoot one up to shoot 4, so 4 columns of dates. What I want to do is have any of those dates that fall into "This Week" to be displayed in a column on another sheet titled the same thing. Followed by a column with "Next Week" and "Next Month" so that I can see at a glance all the upcoming shoot days. Quite simply I have no idea how to do this.

Another aspect of it is that I also want the first 2 columns of the data sheet to display next to the date in the dashboard sheet as well as this holds the client name and project name. The first 2 columns being '2022'!A3:B and the list of dates being '2022'!S3:V.

Any help or guidance will be massively appreciated!

I have tried using an Array Formula and Filter formula but am struggling to know what to search to find the answer I need so have come on here for some help.


Solution

  • this week:

    =ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
     IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V, 
     "dd/mm/yy\×dddd")&"×"&WEEKNUM('2022'!S3:V, 2)&"×"&'2022'!C3:C)), "×"), 
     "where Col6 matches 'ACTIVE|ENQUIRY' 
        and Col5 = "&WEEKNUM(TODAY(), 2)), 9^9, 4))
    

    next week:

    =ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
     IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V, 
     "dd/mm/yy\×dddd")&"×"&WEEKNUM('2022'!S3:V, 2)&"×"&'2022'!C3:C)), "×"), 
     "where Col6 matches 'ACTIVE|ENQUIRY' 
        and Col5 = "&IF(WEEKNUM(TODAY(), 2)+1>WEEKNUM(DATE(YEAR(TODAY()), 12, 31), 2), 1, 
     WEEKNUM(TODAY(), 2)+1)), 9^9, 4))
    

    next month:

    =ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
     IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V, 
     "dd/mm/yy\×dddd")&"×"&MONTH('2022'!S3:V)&"×"&'2022'!C3:C)), "×"), 
     "where Col6 matches 'ACTIVE|ENQUIRY' 
        and Col5 = "&MONTH(EOMONTH(TODAY(), 1))), 9^9, 4))
    

    enter image description here

    demo sheet