Microsoft Word
--
Questions
--
Followers
Top Experts
I it possible to add fields to an agenda template so that if the starting time is inputted, and times for each topic are added, an end time for each topic could be calculated?
Thanks,
Michael
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Select the last cell in a column, choose Formula on the Layout tab and type
= SUM(ABOVE) into the dialogue.
Note that to update the total, press F9 when the field is in the selection.
Other field solutions that do not total columns can use bookmarked locations or Excel-like cell notation.
A VBA method with Content Controls would also be possible.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I'd suggest the approach implied by Grahams comment - the agenda items would need to be in a table and then sum up the table... Â there would be quite a few calculations hidden in the document if you want to calculate the running time. Â
Also if you were distributing to others PDF might be worth considering... (don't want people breaking the word document).
I think you can do this but it might be fiddly to use if using field codes. Â The other option as per Grahams suggestion is VBA - if you are able to go down that path I think you can cut out a lot of complexity and make the overall document easier to work with.
Hope this helps,
Word fields do not have a Date/Time calculation method. This link shows the complexity of using fields to calculate a given number of days ahead:
http://www.gmayor.com/insert_a_date_other_than_today.htm
Time-only calculations might be a bit simpler, but I can't think of a way to separate a piece of text like 11:30 into 11 and 30. The example above uses CreateDate three times to get each part of the current date. It doesn't start from text, so could use an arbitrary date.
This means that you will have to use VBA. The following code expects a ContentControl in cells 2 and 3 of each row in the table, except for the first (header) and last (total) row.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim tbl As Table
Dim r As Integer
Dim rw As Row
Dim strTime1 As String
Dim strTime2 As String
Dim dtTime1 As Date
Dim dtTime2 As Date
Dim dtTotal As Date
Dim dtDuration As Date
If ContentControl.Range.Tables.Count = 1 Then
Set tbl = ContentControl.Range.Tables(1)
For r = 2 To tbl.Rows.Count - 1
Set rw = tbl.Rows(r)
strTime1 = rw.Cells(2).Range.ContentControls(1).Range.Text
strTime2 = rw.Cells(3).Range.ContentControls(1).Range.Text
rw.Cells(4).Range.Text = ""
If IsDate(strTime1) Then
dtTime1 = CDate(strTime1)
If IsDate(strTime2) Then
dtTime2 = CDate(strTime2)
dtDuration = dtTime2 - dtTime1
rw.Cells(4).Range.Text = Format(dtDuration, "HH:nn:ss")
dtTotal = dtTotal + dtDuration
End If
End If
Next r
If CDbl(dtTotal) = 0 Then
tbl.Rows.Last.Cells(4).Range.Text = ""
Else
tbl.Rows.Last.Cells(4).Range.Text = Format(dtDuration, "HH:nn:ss")
End If
End If
End Sub
If have modified the table in your document down to four rows for demonstration purposes and added Content Controls and the macro above in the ThisDocument module.
Note that the file extension should be put back to .docm after you have downloaded it.
I am having problems downloading and opening the file, even after changing the file extension to docm.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Does your agenda have substantial formatting that would preclude from performing the whole thing in Excel rather than Word.
A cell in excel can be set fairly wide and deep to accommodate multiple lines of text and then the time calculations would be much simpler.
Duration doesn't have to be added in true time format if you don't wish, it can use literal numbers so 45 would be 45 minutes or 00:45 if viewed in time format.
The link for finish time would also then be a lot simpler.
Thanks
Rob H
Microsoft Word
--
Questions
--
Followers
Top Experts
Microsoft Word is a commercial document editing program that is part of the Microsoft Office suite. It features numerous text-editing tools for creating richly formatted documents, along with tools for the use of macros in Word documents. Word's native file formats are denoted either by a .doc or .docx file extension. Plugins permitting the Windows versions of Word to read and write formats it does not natively support, such as the OpenDocument format (ODF) are available. Word can import and display images in common bitmap formats such as JPG and GIF. It can also be used to create and display simple line-art.