Using SharePoint Calculated Fields
Problem
SharePoint is a great adhoc tool for storing data. Sometimes it is necessary to make automated calculations based on user inputs. Let's take a look at how to calculate the difference between two dates using SharePoint calculated columns.Solution
SharePoint provides a Calculated Field feature which facilitates the automation of derived columns. You can have numeric calculations as well as manipulating text-based strings. This solution shows how to calculate the number of years between start and end dates of a list item.- Create a sample list containing information that uses two date fields. One such list can be seen in the screenshot below.
Let's see how to calculate the difference between the start date and end date columns. For that we need to define a calculated column.
- Click on Settings -> Create Column, and provide a relevant name for the column.
- Select "Calculated Column" as type of the field.
- We will use the date difference function, DATEDIF, with start date and end date to get number of years. Place the formula exactly as shown for desired results.
- Select "Number" as the data type of the calculated field
Comentarios
Publicar un comentario
Dime si la información de este blog te sirvio.