Search code examples
exceldateexcel-formulaexcel-2013datediff

Find difference in dates. But if one date field is empty use a 3rd option with Excel


I'm dealing with a spreadsheet in Excel that has a Start Date, End Date and Inquired Date Fields.

I need to find the time it took from the Start Date to the End Date. However sometimes the End Data is empty, so we would like to use the third field "Inquired Data Fields"

The only solution I know of as I'm very rusty with Excel is using

DATEDIF(start_field, end_field, d)

However this just pulls two fields, and doesn't take into consideration of a third option if the end_field is empty).

Any ideas? Hopefully this can help other people in the future as well if a solution is found!


Solution

  • Try: =IF(ISBLANK(B2),C2-A2,B2-A2)

    Where column A is the Start Date, column B is the End Date, and column C is the Inquired Date.