Domanda

I have a column HireDate, a date column, and I would like to have a Seniority column number of years depending of Today's Date - Hire Date.

Any help please?

È stato utile?

Soluzione

You try the below and let me know

=IF(NOT(ISBLANK(HireDate)),INT(DATEDIF(HireDate,TODAY(),"d")/365),"")

You would like to keep the decimal places, use ROUND() function:

=IF(NOT(ISBLANK(HireDate)),ROUND(DATEDIF(HireDate,TODAY(),"d")/365,1),"")

enter image description here

Altri suggerimenti

In addition to the first answer: if you want to round the numeric value down toward zero, use FLOOR function instead.

For example, 5.27 will be calculated as 5.2 instead of 5.3; 1.7 will be calculated as 1 instead of 2.

For integer:

=IF(NOT(ISBLANK([HireDate])),FLOOR((TODAY()-[HireDate])/365,1),"")

For decimal:

=IF(NOT(ISBLANK([HireDate])),FLOOR((TODAY()-[HireDate])/365,0.1),"")
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top