Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Convert time from text

Hello,

I copied from a pdf several lines of data, in which included the time
formated like this: 12:40P. Two questions:
1) how do I convert this text time to real time accurate to AM/PM?
2) How do I seperate out AM/PM to different cell for other use?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Convert time from text

I'd select the range to fix and then
Edit|Replace
what: P
with: (space character)PM
replace all

And the same kind of thing if you have 12:40A in cells.

And once you converted that cell to a real time, you wouldn't need another cell.

You could just check to see if the value is before or after noon (.5 of a day).

=if(a1.5,"PM",if(a1<.5,"AM","Noon"))

I'm not sure how you want to treat 12:00 Noon.

(time is a fraction of a day (12/24 = .5 = half a day)

Jim wrote:

Hello,

I copied from a pdf several lines of data, in which included the time
formated like this: 12:40P. Two questions:
1) how do I convert this text time to real time accurate to AM/PM?
2) How do I seperate out AM/PM to different cell for other use?

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 222
Default Convert time from text

You only gave one example of a time, so I'm not sure if the date values are
always the same number of characters...how is 1:15AM shown?

Anyway, here's a formula approach to convert the date text in cell C1 to a
real Time value, perhaps in D1:

=IF(ISNUMBER(SEARCH("A",C1)),
TIMEVALUE(LEFT(C1,FIND("A",C1)-1)),
TIMEVALUE(LEFT(C1,FIND("P",C1)-1)))

You can use that same IF test looking for the "A" in the next cell over in E1:

=IF(ISNUMBER(SEARCH("A",C1)),"A","P")

Copy those formulas down to convert the whole column, then copy/paste
special values over the top of themselves to turn them into permanent values.

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Jim" wrote:

Hello,

I copied from a pdf several lines of data, in which included the time
formated like this: 12:40P. Two questions:
1) how do I convert this text time to real time accurate to AM/PM?
2) How do I seperate out AM/PM to different cell for other use?

Thanks

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
Convert Time to a Text CJ Excel Worksheet Functions 3 April 2nd 07 06:56 PM
Convert Text Time to Excel Time [email protected] Excel Discussion (Misc queries) 5 January 29th 07 04:43 PM
How do I convert text to time Curtis Excel Worksheet Functions 4 February 9th 06 07:30 PM
Text to time convert Rudo Excel Discussion (Misc queries) 2 November 14th 05 01:00 AM
convert time imported as text to time format for calculations batfish Excel Worksheet Functions 3 October 27th 05 11:24 PM


All times are GMT +1. The time now is 06:14 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"