Splitting data in a cell

V

Verne

I have a spreadsheet that has a date and time in one
cell. I need to use this data to generate an SLA report
showing the time difference between the two. How do I
separate (strip) the two different data types so I can
analyze it to create my SLA reports?
 
T

Tom Ogilvy

dim dtDate as Date
dtDate = Int(Range("A1").Value)
msgbox format(dtDate, "mm/dd/yyyy")

By taking the integer part of the number you strip off the time.

in a worksheet formula

=Trunc(A1)
format the cell as date.

Regards,
Tom Ogilvy
 
T

Tom Ogilvy

Of couse the time would be
dim dtDate as Date
dim dtTime as Date
dtDate = Int(Range("A1").Value)
dtTime = Range("A1").Value - dtDate
msgbox format(dtDate, "mm/dd/yyyy") & " - " & _
format(dtTime,"hh:mm:ss")


=A1-trunc(a1) and format as time.
Regards,
Tom Ogilvy
 

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