# How do you calculate the number of days between two tasks in Microsoft Project?

I've created an event planning project that explains all of the relevant tasks before, during, and after a given event in MS Project 2003. I would like to calculate the number of days between a given task and a task I've created called "Host Event". The best way I've been able to do it thus far is create a custom number column with a formula of:

``````Int([Project Finish]-8-[Start])
``````

It essentially does the trick, as the "Host Event" task is 8 days away from the Project Finish date. However, this seems like bad coding because I hard-coded the 8 days and if I were to ever change any task durations after the "Host Event" task, it would completely throw off the formula.

Is there a better way that I can perform the following calculation?

``````Int([Project Finish]- ["Host Event" Start])
``````

• see here: 24x7coach.com/ms-project-blog/… Jul 2, 2017 at 10:07
• Atmane El Bouachri - the request is the difference between selected task and another task. Not between selected task and project start / end date. Oct 29, 2018 at 15:42
• Can you reference the project title in 2003 custom formulae? If you can, perhaps you can add the event date to the title, extract that from the project title using atext functions, then convert it to date and use that as your event date? But... the more important question is why you want to do this. I would argue that this isnt especfially interesting information. You may be a thousand days from your event, but have no slack and all work is underestimated. And you could be 10 days away form your event with only 1 days work to do... Oct 29, 2018 at 15:50

I'm not sure I understand entirely. Do you want to calculate the difference between the Host date and the Project Finish date or from the host date to the finish date for all tasks?

You could enter the date of the host event into a spare date field. (Date1 for example). Fill the date down and then write the formula int([Finish]-[Date1])

Short of code (VBA) there is no way to refer to another tasks's information for a single task.

• Could you not set up a dummy hammock task between milestones attached to the required start and end dates and then read the duration of that hammock task? Aug 6, 2016 at 9:04
• @JulieS I would like the difference in days between the "Host Event" start date and the start date of every other task. I think I will try to take your suggestion of entering the date of the event into its own column and do the date subtraction via another custom field. I'll let you know the result. Aug 7, 2016 at 11:35
• If you want every task - then use the suggestion I supplied. It will calculate for every task. I forget to mention that the formula should be in a number field. Aug 7, 2016 at 16:11