Time Difference between two dates

D

DeepaK

Hi,

The basic objective of myself is to get the Time difference of tw
dates.

1. I am using excell macro for inserting the date and time into th
excel sheet.

2. The Start date, Start time, EndDate and EndTime are inserting int
four different cells of excell from a *.csv file using the exce
macro.

3. All the things are happening. But I need to calculate the tim
difference between the start time and End time.

After reading the excel help I came to know that the excel need th
Start Time and End Time in "Date & Time Format" in single cell itsel
then only the difference can be calculated using "=A1-B1".
For example:
A1 = 18/04/2004 19:00:00
B1 = 19/04/2004 21:00:00

Since the excell needs the date and time to be entered in one cell it
getting tougher for me.

Because the excell macro is inserting the decimal value(instead o
inserting in time format) into the excel cell eventhough its availabl
in the csv file in exact time format.

For inserting only the time there is no problem for me , since I hav
the option of individuual cell format. I had set the cell format int
"hh:mm:ss".

Please tell me what format should I use to get the date&Time in on
cell as "dd/mm/yyyy hh:mm:ss" (eg:19/04/2004 21:00:00)

I had tried Format cell, then I had selected Custum and enter th
"dd/mm/yyyy hh:mm:ss" after that the date is showing correctly but th
time is still in decimal format only.

If I get the date&time is the above mention form then I will be able t
get time difference between two dates.

Note: My system Date Format is dd/mm/yyyy and Time Format is HH:mm:ss


Please help me to get rid of this problem at the earliest.

Looking forward for your valuable reply

Thanking you
Yours Sincerly

Deepak C Mohan
-------------------------------
Project Leader - S.C.A.D.A
Protocol Automation Technologies Pvt Ltd.
Bangalore - 25
India.
Asia
 
T

Tom Ogilvy

you don't have to have them in one cell

=(End_Date + End_Time) - (Start_Date + Start_Time)

format the result cell (cell with the above formula) as
[hh]:mm with a custom number format if you want the results in hours and
minutes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top