Results 1 to 2 of 2
2016-07-15, 16:47 #1
- Join Date
- Jul 2016
- Thanked 0 Times in 0 Posts
How to format mail merge hh:mm to time digital format
Hello Word experts,
I'm using MS Word 2016 and am working with merge fields that display time duration i.e. 3:30, meaning three hours and thirty minutes duration on a work related job.
I need to multiply this in Word, i.e. 3 x 3:30
However it seems I need to convert 3:30 to 3.5 hours so I can do the math.
Ultimately I'd like 3:30 converted to 3.5
Or should I convert 3:30 to 210 minutes and then multiply?
Basically there are three workers that worked on a job for 3 1/2 hours. I need to know the total hours worked on the job for billing 10.5 hours to the customer
I guess i'd be using the SUM ABOVE/BELOW/LEFT etc to do the calculation (see attachment)
Is there an equation to do this?
Last edited by chuck-st; 2016-07-15 at 16:53. Reason: wanted to add jpg
2016-07-15, 17:09 #2
- Join Date
- Mar 2004
- Manning, South Carolina
- Thanked 1,480 Times in 1,346 Posts
Here's how to do it in VBA.
You just need to incorporate your fields into the calculation and return the result. This may be best accomplished in the source data for the merge operation.
Option Explicit Sub Test() Dim tBase As Date Dim tTotal As Date tBase = TimeValue("3:30") tTotal = tBase * 3 MsgBox "The total time is: " & _ Format(tTotal, "hh:mm"), _ vbOKOnly + vbInformation, _ "Total Job Time" End Sub