calculating difference between d

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Calculating difference between dates

Calculating difference between dates

resolvedResolved · Low Priority · Version 365

Uday has attended:
Excel Intermediate course

Calculating difference between dates

Hi,
I want to calculate the number of days between two dates, on a spreadsheet where some of the dates are missing.

so, for example, I am trying to work our how long we have had a number of projects ongoing for. Some projects have already completed, so I have a closure date, but some projects are still ongoing, so I want to use today's date (today function).

In this Scenario:
Column A has the project start date
Column B has the closure date (with some cells blank where the project is still ongoing)
Column C has today's date (using the today() function).
Column D is where i want to work out the total number of days a project has been ongoing for.

Is there a single formula I can use in column D which will populate the total number of days either by calculating the difference between column B minus column A or, where column B is blank, Column C minus column A?

(NOTE: the data is in a table, so I cannot have two different formulae in column D by selecting the blank cells of column B only)

RE: calculating difference between dates

Hi Uday,

Thank you for the forum question.
Try in D2 (if your first record is in row 2)

=if(B2="",D2-A2,B2-A2)


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector


 

Excel tip:

Finding your worksheets quickly

The arrows to the left of the worksheets are used to move between one sheet at a time or first / last worksheet, but if you right click on the arrow buttons it gives you all worksheets in your workbook.

View all Excel hints and tips


Server loaded in 0.08 secs.