first of all, it needs to be a TRUE Excel "DATE", not just a string of characters that LOOK like a date.
To determine this, try changing the format to "General". If it is a date, it will convert to a number. That's because to Excel, a "date" is really the number of days since 1/1/1900. So today, 1/27/2011 is 40570 Now, TIME is simply the fractional part of a day. so.. 9:00am is .375 of a full day. 9:24:45 am is: .39219 of a day. So 1/27/2011 09:24:45 is 40570.39219 The difference between two dates is found by subtracting the numbers. If you want the result in hours, multiply the difference by 24 If you're looking for a VBA solution, try using DateDiff '========================== Now, this all assumes that the values are Dates to begin with. If they are text strings, then you'll need to convert them to dates. If they are a string representing the current "regional" format for dates (excel will allow you to set the default date format to mm/dd/yyyy or dd/mm/yyyy) then you can use datevalue() to convert it to an excel Date. hope this helps Paul ________________________________ From: Jitendra Verma <jitendra.kumarve...@gmail.com> To: excel-macros@googlegroups.com Sent: Thu, January 27, 2011 12:18:23 AM Subject: $$Excel-Macros$$ Calculate Difference between two dates Hi, How do we calculate the difference between two dates in Hours. Dates are like mm/dd/yyyy format only. -- Thanks and Regards,Jitendra Kr. Verma| Sr. Software Engineer Mob: +91.9700695633 -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel