Here’s what we want to do:
By the way, the following is just a variation of an earlier article on how to color code a calendar. The “big change” is an IF statement to make the formatting conditional. By expanding the calculated column’s formula a bit you can have both color coded and canceled events.
The basic steps are:
- Add a column to the calendar list to indicate that the event has been canceled
- Add a calculated column to create the HTML to display the formatted cancelation message. This can be done with HTML or CSS. This example just uses "<s> text </s>"
- Add the new column to the calendar view
- Create or open a calendar
- Add a new column named "Canceled" (Settings, List Settings) – most likely type will be "Choice" with choices like "No” and “Yes" with a default of “No”
- Add a new column named "CalendarText"
- Column Type is Calculated
- Equation is:
=IF(Canceled="Yes", "<s>" & Title & "</s>", Title )
- Data type returned = single line of text
- If you want to also change the color, then add a FONT or SPAN tag:
=IF(Canceled="Yes", "<font color=’gray’><s>" & Title & "</s></font>", Title )
- Modify the existing view, or create a new view such as "Calendar with cancel"
- Add a Content Editor web part
- Site Actions, Site Settings, Edit Page
- Add a Content Editor web part and move it below the calendar web part
- Click in the web part click Edit, Modify Shared Web Part
- Click Source Editor
- Click Save, OK, Exit Edit Mode
- Add a new calendar item and select a status – canceled events should now be crossed out.