Sharepoint Calculated Column Year Without Comma
This guide explains how to create a SharePoint calculated column that displays the current year in the format YYYY without any commas. This is useful for creating dynamic year references in SharePoint lists.
Introduction
In SharePoint, calculated columns allow you to perform calculations based on other columns in your list. One common requirement is to display the current year in a specific format without any commas. This guide will walk you through the process of creating such a calculated column.
SharePoint's built-in date functions can be used to extract the current year, but the default output may include commas or other formatting that you don't want. By using the TEXT function, you can format the year exactly as you need it.
How to Create a SharePoint Calculated Column for Year Without Comma
Follow these steps to create a calculated column that displays the current year without commas:
- Open your SharePoint list where you want to add the calculated column.
- Click on the "Settings" gear icon in the top-right corner and select "List settings".
- In the List Settings page, click on "Create column".
- In the "Create Column" dialog box, select "Calculated (calculation based on other columns)" as the column type.
- Enter a name for your column, such as "YearWithoutComma".
- In the "Formula" field, enter the following formula:
=TEXT(YEAR(NOW()),"0000")
- Select "Number" as the data type for the column.
- Click "OK" to create the column.
Note: The formula uses the YEAR function to get the current year and the TEXT function to format it as a 4-digit number without commas.
Formula Explanation
The formula used in this calculated column is:
Here's what each part of the formula does:
NOW()- Returns the current date and time.YEAR(NOW())- Extracts the year from the current date.TEXT(YEAR(NOW()),"0000")- Formats the year as a 4-digit number without commas.
The "0000" format code ensures that the year is always displayed as a 4-digit number, even if the year is less than 1000. This prevents any commas from appearing in the output.
Example
Let's say the current year is 2023. When you use this calculated column in your SharePoint list, it will display:
Example Output
2023
Instead of:
2,023 (which would happen if you used just the YEAR function without formatting)
This ensures that the year is always displayed in the exact format you need, without any unwanted commas or formatting.
FAQ
Yes, this formula works in both SharePoint Online and SharePoint on-premises.
Yes, the calculated column will automatically update whenever the list is viewed, as it uses the current date and time.
Yes, you can modify the format code in the TEXT function to display the year in a different format. For example, "00" would display the last two digits of the year.
No, SharePoint calculated columns are recalculated each time the list is viewed, so the year will update whenever someone views the list. If you need a static year value, consider using a single-line text column instead.