Get the year from other column

Copper Contributor

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. 

 

9 Replies

@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

@ganeshsanap 

 

Hi this a screenshot of my column settings. The column 'Datum JAP' is a standard date&time column. 



SPL.png

@Jonas_Daragas I just tried it at my end and it works for me. Formula I used: 

 

=IF(ISBLANK([Date]),"",YEAR([Date]))

 

Column Settings

ganeshsanap_1-1680010831498.png

 Output

ganeshsanap_0-1680010684955.png


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

Yes 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.

@Jonas_Daragas 

Note

  1. 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.

DocumentationCalculated 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

I 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

ganeshsanap_0-1680011931238.png

 


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

Syntaxis error

@Jonas_Daragas You have to adjust the formula as per the language of your SharePoint site.

 

Refer to my above note about using semicolons instead of commas now. Refer documentation link for more information about functions used in calculated column formula.


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