SharePoint calculated column: difference between two dates

In this SharePoint tutorial, I will show you some examples of SharePoint calculated column difference between two dates.

I will show you how to create a calculated column to get the difference between the two dates in a SharePoint list and create a calculated column to get the difference between the two dates in hours in a SharePoint list.

Moreover, I will explain how to create a calculated column to get the difference between the two dates in minutes in the SharePoint list. And also, I will cover how to create a calculated column to get the difference between the date and today in SharePoint online list.

Let me explain with an example, and I have a SharePoint Online list that has a two date column:

  1. Issue Start Date
  2. Issue Resolved Date

Based on that column, I will create a calculated column to get a difference between two dates in days, hours, and minutes and a difference between the date and today from the date column in SharePoint online list.

SharePoint calculated column: difference between two dates

Based on my SharePoint list, I will show how to create a calculated column to get the difference between two dates.

Modern SharePoint calculated column difference between two dates

To achieve this, follow the below steps:

  • Open your SharePoint List, where you must show the difference between the dates in days.
  • Click on the +Add column -> choose See all column types -> Then click on the Next button.
SharePoint Online calculated column difference between two dates
  • In Create column page, provide the column name and choose the type as Calculated (calculation based on other columns) as shown below:
SharePoint calculated column difference between two dates
  • Now provide the formula in the formula box using the DATEDIF function. Based on my requirement, I provided the formula as shown below:
=DATEDIF([Issue Start Date],[Issue Resolved Date],"d")
  • The data type returned from this formula is: Choose the data type as a Number.
  • Then, click on the OK button.
Create an SharePoint calculated column difference between two dates
  • Now open your SharePoint list, the calculated column will be added as Days took to resolve issue.
SharePoint calculated the column difference between two dates in days

This is how to create a calculated column to get a difference between two dates in days.

SharePoint calculated column: difference between two dates in hours

Based on my SharePoint list, I will create a calculated column to get a difference between two dates in hours.

Modern SharePoint calculated the column difference between two dates in hours

To achieve it, follow the below steps:

  • Open your SharePoint List, where you must show the difference between the two dates in hours.
  • Click on the +Add column -> choose See all column types -> Then click on the Next button.
  • In Create column page, provide the column name and choose the type as Calculated (calculation based on other columns) as shown below:
SharePoint calculated the column difference between two dates in hours
  • Now provide the formula in the formula box using the INT statement. Based on my requirement, I provided the formula as shown below:
=(INT(([Issue Resolved Date]-[Issue Start Date])*1440)-MOD(INT(([Issue Resolved Date]-[Issue Start Date])*1440),60))/60&" Hours "
  • The data type returned from this formula is: Choose the data type as Number.
  • Then, click on the OK button.
SharePoint online calculated the column difference between two dates in hours
  • Now open your SharePoint list; the calculated column will be added as Hours.
Modern SharePoint online calculated the column difference between two dates in hours

This is how to create a calculated column to get a difference between two dates in hours.

SharePoint calculated column: difference between two dates in minutes

Based on my SharePoint list, I will create a calculated column to get the difference between two dates in minutes.

Modern SharePoint calculated the column difference between two dates in minutes

To achieve it, follow the below steps:

  • Open your SharePoint List, where you must show the difference between the two dates in minutes.
  • Click on the +Add column -> choose See all column types -> Then click on the Next button.
  • In Create column page, provide the column name and choose the type as Calculated (calculation based on other columns) as shown below:
SharePoint calculated the column difference between two dates in minutes
  • Now provide the formula in the formula box using the INT statement. Based on my requirement, I provided the formula as shown below:
=(INT(([Issue Resolved Date]-[Issue Start Date])*1440)-MOD(INT(([Issue Resolved Date]-[Issue Start Date])*1440),60)&" Minutes")
  • The data type returned from this formula is: Choose the data type as Number.
  • Then, click on the OK button.
Create an SharePoint calculated the column difference between two dates in minutes
  • Now open your SharePoint list; the calculated column will be added as Minutes.
SharePoint online calculated the column difference between two dates in minutes

This is how to create a calculated column in the SharePoint list, to get the difference between two dates in minutes.

SharePoint calculated column days between a date and today

Based on my SharePoint list, I will create a calculated column to get a difference between the date and today.

Modern SharePoint calculated column days between the date and today

To achieve it, follow the below steps:

  • Open your SharePoint List where you need to show the difference between the date and today.
  • Click on the +Add column -> choose See all column types -> Then click on the Next button.
  • In Create column page, provide the column name and choose the type as Calculated (calculation based on other columns) as shown below:
SharePoint calculated column days between the date and today
  • Now provide the formula in the formula box using the DATEDIF statement. Based on my requirement, I provided the formula as shown below:
=DATEDIF([Issue Resolved Date],TODAY(),"D")
  • The data type returned from this formula is: Choose the data type as a Number.
  • Then, click on the OK button.
Create an SharePoint calculated column days between the date and today
  • Now open your SharePoint list; the calculated column will be added as Issue Resolved days taken for today.
SharePoint online calculated column days between the date and today

This is how to create a calculated column to get the difference between the date and today in a SharePoint list.

Conclusion

Here I have shown you all how to create a calculated column to get the difference between the two dates in the SharePoint list and how to create a calculated column to get the difference between the two dates in hours in the SharePoint list.

And also, I have explained how to create a calculated column to get the difference between the two dates in minutes in the SharePoint list. And also how to create a calculated column to get the difference between the date and today in SharePoint online list.

You may also like: