Extract Year From Date Using YEAR() Function in Salesforce : Bijay Kumar
by: Bijay Kumar
blow post content copied from SalesForce FAQs
click here to view original post
### Summary of Extracting Year from Dates in Salesforce When working with Salesforce, you may need to extract just the year from a date, like the Contract Start Date. This is useful for reporting and organizing data. Salesforce provides a straightforward way to do this using the `YEAR()` function. Here's a simple overview of how to create a formula field that shows just the year of a date: 1. **Access Setup**: Go to the Gear Icon, click on Setup, then select the Object Manager tab and choose the relevant object, such as the Contract object. 2. **Create Field**: In the Fields and Relationships section, click on New to create a new field. 3. **Select Formula Type**: Choose Formula as the data type. This allows you to write a formula that extracts the year. 4. **Field Details**: Enter the Field Label and API Name. Set the Formula Return Type to Text to ensure the year is displayed correctly. 5. **Enter Formula**: In the formula editor, use the `TEXT(YEAR(StartDate))` formula, which extracts the year from the StartDate field. Validate the formula to check for errors. 6. **Field Security**: Set field-level security by selecting which profiles will have access to this new field. 7. **Configure Page Layouts**: Decide if the field should appear on the object’s page layout. Since it is primarily for reports, you can choose not to display it there. Once you've saved the formula field, you can now see the extracted year from the Contract Start Date in your Salesforce records. ### Conclusion By following these steps, you can easily create a formula field in Salesforce that extracts and displays the year from a date using the `YEAR()` function. This feature is beneficial for various tasks such as reporting and automation. ### Additional Information This process is particularly useful for age calculations, event planning, financial analysis, and managing document validity periods in Salesforce. ### Relevant Hashtags for SEO #Salesforce #DateFormulas #SalesforceYEAR #SalesforceTips #CRM #DataManagement #ReportAutomation #TechGuides #SalesforceFormula #BusinessIntelligence
When working with Salesforce date formulas, we occasionally need to extract the year from a date.
For example, suppose we are tracking the Contract Start Date on the contract object, and we want to create a date formula field that only shows the year part of that date (like 2025) for reporting or grouping purposes.
Year Function in Salesforce Formula
Extract Year From Date Using Formula in Salesforce
Below, I will explain how we can extract the year from a given date so that it can be used in formulas, reports, or automation in Salesforce.



TEXT(YEAR( StartDate))
Provide this formula and click the Check Syntax button to confirm the formula is correct, and click the Next button.


7. In this step, we must select the field’s visibility on the object’s page layouts. In this case, we have created the formula field for the reports so we can choose not to display it on the page layouts.
Uncheck the checkboxes of the page layouts to prevent the field from displaying on them. After this, click on the Save button.

We have now created the formula field that will return the year from the Contract Start Date field from the contract object.
As you navigate to the object, you will see the formula field that you created to extract and display the year from the contract start date.

In this way, we can create a formula field to store the extracted year from the given date in Salesforce.
Conclusion
You may like to read:
- Create Cross-Object Formula Field in Salesforce
- Use Date Formula in Salesforce Report
- Create Row Level Formula in Salesforce Report
- Salesforce Formula If Date is Less Than Today
The post Extract Year From Date Using YEAR() Function in Salesforce appeared first on SalesForce FAQs.
August 20, 2025 at 09:48PM
Click here for more details...
=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Post a Comment