How to get the corresponding month name from a weeknumber?

Hello, I am new to Coda.

I am building an editorial timeline where I am displaying our different newsletters (each in its own column) along the week number on the left (each week = 1 row). I want to see all weeks, and I populate the cells to check wether on the given week, a given newsletter is scheduled ; this part works.

But I also do want to automatically display in a column the name of the month corresponding to the week number in the row.

I don’t see any Date function that would enable me to do so. I have thought about trying something with the function MonthName, but it only accepts a date as argument. However the argument I have is a week number…

Any thoughts / hints on how I could achieve that ?

bonsoir Xavier,

There are various ways to obtain the result. The easiest is maybe that you go to this page and take all the values for the year 2021 (all dates, etc)

via a filter you check the month that relates to the week number

you could get an error message, this is a bug Coda is aware off and they plan to fix it.

If you want to generate a table like this it is rather easy. Create two tables as below and use the formula as given.

Sequence(thisRow.from,[alle dates in 2021],[alle dates in 2021].dates,CurrentValue,
[alle dates in 2021].weeknumber,CurrentValue.WeekNumber(),[alle dates in 2021].month,CurrentValue.Month()))

And of course this also could be done without the two tables, all in one table via a formula, but the approach above is visually speaking understandable if you get started with Coda.

cheers, Christiaan


@Xavier_Rabilloud , this is the shorter and easier version without the need of the tables.
to keep it easy create the from and to date and then let the formula run over the weeknumber.

Sequence(thisRow.from, = thisRow.weeknumber).FormulaMap(CurrentValue.Monthname())

I did not add unique, of course it can happen that your week is partly month 1 and partly month 2, up to you to see how you deal with it.

1 Like

Dear @Christiaan_Huizer many thanks for your insights. Would you please be so kind as to also post the content the weeknumber column formula ? I cannot get this solution working.

Sequence(thisRow.from, = thisRow.weeknumber).FormulaMap(CurrentValue.Monthname())

it is the column you use to enter manually the ‘weeknumber’

I need to add something and this is that the Coda weeknumbers are based on USA standards and their week starts on Sunday

the IsoWeekNumber() is the version starting on Monday and this one you might prefer :slight_smile:

Sequence(thisRow.From, = thisRow.Weeknumber).FormulaMap(CurrentValue.Monthname())

hope it helps to get you started this week!

1 Like

Oh great, many thanks @Christiaan_Huizer , I got it !

I was able to use this version of the function to directly extract the month(s) corresponding to the weeknumber. I added Unique() to only keep one instance of each month in the list :

Sequence(thisRow.from, = thisRow.Weeknumber).FormulaMap(CurrentValue.Monthname()).Unique()


good to see you solved this part of the puzzle @Xavier_Rabilloud !

you might want to go even one step further. sometimes you have two months in one week. below the steps to force a choice.

and in the last step I make some hard coded choices and these you can put as you see fit. Here is equal or greater than 4 days

As always, this can be put into one formula. However to understand the steps, this might be easier to follow.

Sequence(thisRow.from, = thisRow.[my weeknumber]).FormulaMap(CurrentValue.Monthname()).WithName(TheMonts,
  Sequence(1,TheMonts.Count()).FormulaMap(TheMonts.Nth(CurrentValue) = theMonts.First()).CountIf(CurrentValue=True()).WithName(OutCome, 
    If(OutCome >=4,TheMonts.First(),TheMonts.Last()

1 Like