View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default extract time from text import

Hi,

Try:
=TEXT(B2,"[h]")

Your cell is formatted as [h]:mm:ss and not h:mm:ss. The difference is that
while the second one is a point in time (a date), the first one is an
interval or a length of time.... or something like that.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"HmxPete" wrote:

When I import a text selection, the date format gets changed from 1316:10 to
1316:10:00. It looks like Excel is trying to interpret the time format to a
date and time format.
I've tried using the LEFT function to extract only the 1316, but excel has
already converted the time to its time and date format. A watch is added to
the VBA code to see how excel is intrepretting it. 1316:10 gets converted to
165 or 2/23/1900 8:10:00 PM.
The question is, how do I extract only the hh:mm or hh:mm:ss?

Thanks in advance,
Pete