Forum Discussion
Get the year from other column
Hi
I'm creating a new column in my Sharepoint List. I'm using a calculated value for this column that extracts the year from a 'date' column.
Example:
Date column: 23-02-2023 Year column: 2023
The formule I used for this was =YEAR([Date]). But it's giving me 2.023 instead. The notation is set on numbers with 0 decimals. Tried some changes but can't figure this one out.
Jonas_Daragas Are you using calculated column? Can you show us the screenshot of calculated column settings?
Also just to confirm, what is the data type of another column, date and time?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
- Jonas_DaragasCopper Contributor
Hi this a screenshot of my column settings. The column 'Datum JAP' is a standard date&time column.
Jonas_Daragas I just tried it at my end and it works for me. Formula I used:
=IF(ISBLANK([Date]),"",YEAR([Date]))
Column Settings:
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
- Jonas_DaragasCopper ContributorYes it also works for me like that. But I do not want the , or . in my year. I want it to show as 2023. As it is linked to my Power Apps & it's not the correct way to show the user the year.
Note:
- Sometimes comma( , ) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon( ; ) instead of comma( , ). 2. Use correct display names of your columns in the formula.
Documentation: Calculated Field Formulas
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
- Jonas_DaragasCopper ContributorI don't mean in the formula. I mean the result is showing a , (in your example), mine shows a . (because of my region). So the problem is in the result.
Jonas_Daragas Try using formula in this format:
=IF(ISBLANK([Date]),"",TEXT([Date],"yyyy"))
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs