Forum Discussion

MBuckner1780's avatar
MBuckner1780
Copper Contributor
Jul 17, 2024
Solved

Populating Calendar from an array

I would like to create a monthly calendar view showing milestones for projects based on an array of dates.  Can someone suggest the code needed for some pre-fab calendar that will make this simple?  ...
  • djclements's avatar
    Jul 18, 2024

    MBuckner1780 I'm sure there's probably many templates out there already, but here's one possible dynamic array formula for MS365:

     

    =LET(
        first, DATEVALUE(calendarMonth & " " & calendarYear),
        calendar, SEQUENCE(6, 7, first - (WEEKDAY(first) - 1)),
        days, IF(MONTH(calendar) = MONTH(first), TEXT(calendar, "dd"), TEXT(calendar, "mm|dd")),
        table, tblProjectDates[#All],
        vals, DROP(table, 1, 1),
        test, vals <> "",
        dates, TOCOL(IFS(test, vals), 2),
        keys, TOCOL(IFS(test, TAKE(DROP(table, 1),, 1) & ": " & DROP(TAKE(table, 1),, 1)), 2),
        MAP(calendar, days, LAMBDA(date,day, TEXTJOIN(CHAR(10),, day, FILTER(keys, dates = date, ""))))
    )

     

    With Wrap Text formatting applied, as well as some Conditional Formatting, the output would look something like this:

     

    Project Calendar

     

    Adjust the row heights and columns widths as needed. See attached...

Resources