Dec 12, 2023 08:12 PM - edited Dec 12, 2023 08:22 PM
Hey all 👋
The subject may be confusing.
Basically, I have a column {Day}, {Day} is a single select field.
The options in {Day} includes the following strings:
I want a formula field that returns the date, based on {Day}.
For example, this post is written on 13 Dec 2023, Wednesday.
If {Day} is "monday" then the cell should return 11 Dec 2023. (last monday)
If {Day} is "wednesday" then the cell should return 13 Dec 2023 (today)
If {Day} is "thursday" then cell should return 7 Dec 2023 (last thursday)
how should I write this formula?
Solved! Go to Solution.
Dec 12, 2023 11:06 PM
Dec 12, 2023 11:06 PM
Dec 12, 2023 11:57 PM
Good.
Some formulas are a little simpler.
SWITCH(
{Day},
"Monday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),1,"day"),
"Tuesday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),2,"day"),
"Wednesday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),3,"day"),
"Thursday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),4,"day"),
"Friday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),5,"day"),
"Saturday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),6,"day"),
"Sunday", DATEADD(DATETIME_PARSE(WEEKNUM(TODAY()),"w"),7,"day")
)