Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
subtracting two date/time columns to get total time
I've got two columns that have a value of "Now" (the second column is
added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
subtracting two date/time columns to get total time
with Activecell
.Offset(0,1).Value = .Value - .Offset(0,-1).Value .Numberformat = "hh:mm:ss" End With -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Drew" wrote in message oups.com... I've got two columns that have a value of "Now" (the second column is added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
subtracting two date/time columns to get total time
the numberformat did it. thanks for your help!
Bob Phillips wrote: with Activecell .Offset(0,1).Value = .Value - .Offset(0,-1).Value .Numberformat = "hh:mm:ss" End With -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Drew" wrote in message oups.com... I've got two columns that have a value of "Now" (the second column is added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
subtracting date/time | Excel Worksheet Functions | |||
Subtracting Dates to get total time work time excluding weekends | Excel Discussion (Misc queries) | |||
Subtracting Date/Time | Excel Discussion (Misc queries) | |||
Subtracting Date/Time pairs | Excel Worksheet Functions | |||
subtracting columns one at a time? | Excel Discussion (Misc queries) |