2

When a new list item is added, I'd like a date field (Date From) to be defaulted to Monday of this week, as well as another date field (Date To) to Sunday of next week (creating a 1 week span Mon-Sun). So no matter what day of the week it currently is, these date fields would default to this week's date range.

Can I accomplish this using just the column's default value? If so, how?

Please note I barely know anything about SharePoint and am learning as I go, so I'd prefer a method which doesn't require programming (even though I'm willing to do so if I have to).

1 Answer 1

5

What a fun problem! For column LastMonday:

=IF(WEEKDAY([Created])=1,DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-6),DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-WEEKDAY([Created])+2))

For column NextSunday:

=IF(WEEKDAY([Created])=1,[Created],DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-WEEKDAY([Created])+8))

You can do this as a default value of a date column if you want users to be able to change it, or just make a calculated column of data type "Date and Time", "Date Only" if you don't.

5
  • Awesome, thanks a lot! When I get back to work tomorrow I'll plug it in. Commented Oct 14, 2013 at 23:46
  • I couldn't wait until tomorrow to try, so I remoted into work and tried, adding it as the default value "Calculated Value" copying your text, but I get an error: The formula contains reference(s) to field(s). Commented Oct 15, 2013 at 0:46
  • 3
    @jerry Change [Created] to [Today] in your formula, otherwise, you'll have to create a calculated column.
    – iOnline247
    Commented Oct 15, 2013 at 0:59
  • That made it work! Now just because I like to ensure everything is accounted for before I consider something done, I need to wait until tomorrow anyway to make sure the "Date From" really shows Monday, because Today is Monday :D Commented Oct 15, 2013 at 1:03
  • Good that I had a chance to test it on Monday though, because at least I know Mondays will always default to that same Monday and not the previous or next Commented Oct 15, 2013 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.