I am working with a SharePoint list that contains information about new employees. One column represents the StartDate, another column the EndDate (according the contract).

In my company we have two kinds of identification card, one is for employees that will stay maximum 30 days (visitor pass) and another one is for employees who will stay longer (permanent ID).

In this SharePoint list I want the field ID type to be filled automatically. I tried to add this code in the formula section of ID Type (after you click on edit column):

IF((DATEDIF([StartDate],[EndDate],"D")>30; [ID Type] = "permanent ID"; [ID Type] = "visitor pass")

Unfortunately, the SharePoint list does not save this formula.

1 Answer 1


For your requirements, you have to create a column with "Calculated" data type.

You can use the formula like below in calculated column:

=IF(DATEDIF([StartDate],[EndDate],"D")>30,"Permanent ID","Visitor Pass")

Follow steps given in my answer to create a calculated column in a list at: Formula does not work for SharePoint/Lists


  1. Sometimes comma(,) does not work in formula (I am not sure but it is based on language or regional settings on your site). In that case use semicolon(;) instead of comma(,) at all places in above formula.
  2. You cannot use "calculated value" option of existing columns as this option cannot reference other columns in list in formula. So, you have to create a column with "calculated" data type for referencing other columns in list in calculated formula.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.