Others

How to Convert Existing Microsoft Project Task Durations from Days to Hours

Jason MillerJason Miller Nov 3, 2026 869 views

Question details

The user needs to convert existing task durations from days to hours because modifying the project schedule settings does not automatically update the format of previously entered tasks.

Convert Existing Microsoft Project Durations from Days to Hours
Product
Microsoft Project
Device & OS
not provided
Scenario
Updating the default duration display format in a dynamically calculated project file and attempting to apply this format change to all pre-existing tasks.
Observed behavior
Changing the Project duration display to hours does not update existing tasks. Additionally, some summary rows display arbitrary or unexpected hour values due to calculation conflicts.
Before you start

Before running any macros or modifying task durations in bulk, save a copy of your project file as a backup. Ensure your project calendar is correctly configured (File > Options > Schedule) so that your 'Hours per day' setting accurately reflects your expected conversion.

Solution 1Recommended

Use a VBA Macro to Convert Task Durations Automatically

Running a custom VBA macro is the most efficient way to scan all existing tasks and automatically rewrite their duration values from days to hours.

Since changing the display format in Microsoft Project only affects newly created tasks, existing tasks remain in their original unit (days). The macro below identifies all non-summary tasks currently displayed in days and converts them to hours.

1
Open the VBA Editor

Press ALT + F11 in Microsoft Project to open the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

Click 'Insert' from the top menu and select 'Module' to create a blank script window.

3
Paste the Macro Code

Copy and paste the following code into the module window: Sub ConvertDur() Dim t As Task For Each t In ActiveProject.Tasks If Not t Is Nothing Then If InStr(1, t.GetField(FieldID:=pjTaskDuration), "d") > 0 And t.Summary = False Then SetTaskFieldByID FieldID:=pjTaskDuration, Value:=CStr(t.Duration / 60) & " h", TaskID:=t.ID End If End If Next t End Sub

4
Run the Macro

Close the VBA editor, press ALT + F8 to open the Macros dialog, select 'ConvertDur' from the list, and click 'Run'.

Use a VBA Macro to Convert Task Durations Automatically
Verify Conversions: After the macro finishes running, review your task list to ensure durations now display in hours. Summary tasks will automatically recalculate based on the updated subtasks.
Free Microsoft Office alternative

Manage Project Timelines Easily with WPS Office

Complex project management software can sometimes overcomplicate simple task tracking with rigid calculation rules and VBA requirements. If you need a straightforward, highly compatible way to track project timelines and resources, WPS Office provides powerful Spreadsheet tools. Build custom Gantt charts, track task durations effortlessly, and enjoy full compatibility with Microsoft Office formats.

  1. 1. Download and Install: Get WPS Office for free from the official website and install it on your PC, Mac, or mobile device.
  2. 2. Open WPS Spreadsheet: Launch the WPS Office application and open a new Spreadsheet document.
  3. 3. Use a Project Management Template: Click on the 'Templates' tab, search for 'Project Management' or 'Gantt Chart', and download a free template to start tracking task durations in any unit you prefer.
Track task durations effortlessly using pre-built Gantt chart templates.100% compatible with Microsoft Excel (.xlsx) formats for seamless file sharing.Free and lightweight alternative to complex desktop project management tools.Familiar user interface with zero learning curve for Office users.
microsoft office alternative - wps office

Frequently Asked Questions

Why didn't my existing task durations update when I changed the project schedule settings to hours?

In Microsoft Project, changing the default duration unit via File > Options > Schedule only dictates how newly created tasks are formatted. Existing tasks retain the format they were originally entered in, requiring a manual update or a VBA macro to convert them.

Why are there arbitrary hour values appearing in my summary task rows?

Summary task durations are automatically calculated based on the start and finish dates of their subtasks. If you have cost, work, or material resources improperly assigned directly to a summary task, it can confuse the calculation engine and result in unexpected duration values.

How do I ensure a 'day' equals exactly 8 hours when converting?

Before converting, go to File > Options > Schedule, and verify that the 'Hours per day' setting is exactly 8 (or your preferred working hours). When task durations are mathematically converted by a script or the system, it relies on this specific setting to determine the correct hourly output.