View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Determine elapsed time between two dates

Cells(n, 15).Value = cDate(Cells(n, 10).Value) - cDate(Cells(n, 3).Value)
Cells(n,15).Numberformat = "[h]:mm:ss"

for the comparison cell, it doesn't make any difference, but it will be more
intuitive if you do

--
Regards,
Tom Ogilvy


"JonR" wrote in message
...
I have a spreadsheet where I need to calculate the raw amount of time

between
when a problem was called in and when it was resolved. I am importing

data,
which is a date-time group.

for instance, I need to subtract 10-1-04 17:55 from 10-2-04 18:30. In

this
instance, the answer should be 24:35, as in 24 hours and 35 minutes. It
seems whatever I try with formats or anything else is giving me a

date-time
group instead of a pure elapsed time.

After I do this, I need to compare it to a standard to evaluate our

service
levels.

Should I have the standard in the same format ? [h]:mm:ss, or will this
affect
anything?

I'm currently doing this in VBA with the following line:

Cells(n, 15).Value = Cells(n, 10).Value - Cells(n, 3).Value

where the cells in question contain the date-time values.

Thanks