This is an example of embedding text into a custom number format, and this text must be surrounded by an extra pair of double quotes. Without the extra double quotes, the custom text format looks like this: The value for days is calculated with the INT function, which simply returns the integer portion of the end date minus the start date: Note: Although you can use “d” in a custom number format for days, the value will reset to zero when days is greater than 31.
Include seconds
To include seconds, you can extend the custom number format like this:
Total days, hours, and minutes between dates
To get the total days, hours, and minutes between a set of start and end dates, you can adapt the formula using SUMPRODUCT like this: where “ends” represents the range of end dates, and “starts” represents the range of start dates. In the example shown, D11 contains this formula:
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.