Others

Summarize Task Custom Fields in Microsoft Project

Olivia MillerOlivia Miller Nov 14, 2026 868 views

Question details

The user wants to summarize task custom fields, such as Revenue and Margin, at the project or portfolio level.

Product
Microsoft Project and Project Online
Device & OS
not provided
Scenario
A project manager needs totals or calculated metrics from task-level custom fields for one or more projects.
Observed behavior
Task custom field values need to be aggregated before they can be used in project-level or portfolio reporting.
Before you start

Identify the underlying task field names and data types, such as Number1 for Revenue, rather than relying only on their display names. Decide whether to include summary tasks and whether Margin is an amount or a percentage.

Solution 1Recommended

Sum a task custom field with VBA in Microsoft Project

Use a VBA macro to calculate a total for the active project when a project-level custom field cannot directly aggregate task values.

The example totals Number1 for non-summary tasks and prints the result in the VBA Immediate window. It does not write the total to a project-level custom field.

1
Check the task field

Open the project in Microsoft Project and confirm that Revenue is stored in the task Number1 field. If it uses another numeric task field, replace Number1 in the macro with that field name.

2
Add the macro

Press Alt+F11 to open the VBA editor, choose Insert > Module, and paste: Sub SumTaskRevenue() Dim t As Task Dim total As Double For Each t In ActiveProject.Tasks If Not t Is Nothing Then If Not t.Summary Then total = total + t.Number1 End If Next t Debug.Print "Revenue total: "; total End Sub

3
Run and inspect the total

In the VBA editor, press Ctrl+G to open the Immediate window, place the cursor inside SumTaskRevenue, and press F5. Read the Revenue total in the Immediate window.

Handle margin carefully: Do not simply add margin percentages. If you have task revenue and profit amounts, calculate overall margin as total profit divided by total revenue, provided total revenue is not zero.
Free Microsoft Office alternative

Analyze exported project totals in WPS Spreadsheets

WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility. Open exported project data in WPS Spreadsheets to summarize it, while keeping Microsoft Project or Power BI for native project data and reporting.

Summarize exported task revenue with spreadsheet formulas and pivot tablesOpen and edit Microsoft Excel XLSX workbooks for easy migrationWork in a familiar, easy-to-use spreadsheet interfaceUse a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can a project custom field directly sum task custom fields?

A project-level custom field may not directly aggregate task-level custom fields. Use VBA to calculate a project total or use published Project Online data in Power BI for reporting.

How do I avoid counting task values twice in the VBA total?

Exclude summary tasks when their values already include subtasks. The example macro checks t.Summary before adding each task's Number1 value.

Should I sum the Margin field across tasks?

You can sum margin amounts when appropriate, but percentage margins should not simply be added. Calculate overall margin from total profit divided by total revenue instead.

Why is my custom field missing from Power BI?

Check that the project is published, the reporting data has refreshed, and the field is available in the Project Online reporting feed. In Power BI, reconnect through Home > Get data > OData feed and inspect the available tables and columns.