Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Determine elapsed time between two dates

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Determine elapsed time between two dates

Thanks Tom.

It works great, and I'm all for intuitive.

"Tom Ogilvy" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
jch jch is offline
external usenet poster
 
Posts: 2
Default Determine elapsed time between two dates

I don't know anything about VBA and I tried to put the code you reference in
my worksheet - no luck of course. I need to know the days between two date
cells. Is there a simple formula like there is for cells with numbers?

Thanks
John


"JonR" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Determine elapsed time between two dates

Dates and times ARE numbers: specifically the number of whole and partical
days since Dec 31, 1899.

Excel has no "elapsed time" data type.

Assuming the cell contains both the date and time, you can simply subtract the
start time from the end time. Format the cell as [hh]:mm, or select from the
list of Time formats the one that shows hours 24.


On Thu, 21 Oct 2004 11:11:02 -0700, jch wrote:

I don't know anything about VBA and I tried to put the code you reference in
my worksheet - no luck of course. I need to know the days between two date
cells. Is there a simple formula like there is for cells with numbers?

Thanks
John


"JonR" wrote:

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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determine elapsed time between two dates

=Trunc(EndDate-StartDate)

=Trunc(A2-A1)

format the cell as General (it will probably default to a date format - so
the results will look screwy until you format it to general).

--
Regards,
Tom Ogilvy


"jch" wrote in message
...
I don't know anything about VBA and I tried to put the code you reference

in
my worksheet - no luck of course. I need to know the days between two date
cells. Is there a simple formula like there is for cells with numbers?

Thanks
John


"JonR" wrote:

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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine elapsed time between two dates


Sorry to to jump on this subject, but i have a query along the same
lines.

It concerns the "WEEKDAY" function.

I know very little is documented of it anyway, but is there an
equivalent VBA routine that can be used.

Assuming earlier date is in Cell "A1" and later date is in Cell "B1"
and the resulting difference (in days) is in Cell "C1".

Please advise if possible to do in VBA or not.

Many thanks


--
Jako
------------------------------------------------------------------------
Jako's Profile: http://www.excelforum.com/member.php...fo&userid=8710
View this thread: http://www.excelforum.com/showthread...hreadid=266913

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Determine elapsed time between two dates

Jako,
To determine the number of days between two dates, simply
subtract one date from the other. E.g.,

Dim Dif As Long
Dif = Range("B1").Value - Range("A1").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Jako" wrote in message
...

Sorry to to jump on this subject, but i have a query along the
same
lines.

It concerns the "WEEKDAY" function.

I know very little is documented of it anyway, but is there an
equivalent VBA routine that can be used.

Assuming earlier date is in Cell "A1" and later date is in Cell
"B1"
and the resulting difference (in days) is in Cell "C1".

Please advise if possible to do in VBA or not.

Many thanks


--
Jako
------------------------------------------------------------------------
Jako's Profile:
http://www.excelforum.com/member.php...fo&userid=8710
View this thread:
http://www.excelforum.com/showthread...hreadid=266913



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine elapsed time between two dates


Many Thanks for that info Chip.

Didn't realise it would be that simple!!!

Easier than the standard function

--
Jak
-----------------------------------------------------------------------
Jako's Profile: http://www.excelforum.com/member.php...nfo&userid=871
View this thread: http://www.excelforum.com/showthread.php?threadid=26691

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
elapsed dates between start and end date and time flick Excel Discussion (Misc queries) 2 October 22nd 08 06:55 PM
Need to determine the elapsed Minutes between 2 dates in excel EasyButton Excel Worksheet Functions 3 August 20th 07 04:28 PM
EXCEL 2003 Dates & elapsed time Michell Major Excel Discussion (Misc queries) 3 April 13th 07 12:10 PM
calculate elapsed time between dates and times Jenna Excel Worksheet Functions 2 January 25th 06 04:39 PM
Ref: Formula to calculate elapsed time between certain dates and t DrBarqs Excel Discussion (Misc queries) 2 November 18th 05 11:16 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"