Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default TIMEVALUE - can I use cell reference as argument?

I need to convert a time that I import as text into military time. The time
format is hh:mm:ssPM/AM (in other words, the times in text appear as
01:25:23AM , 02:34:11PM , 11:54:01AM , 03:51:13PM , etc. ).

When I try to use TIMEVALUE, I get the #VALUE! error. It appears that the
argument for TIMEVALUE must be in quotes. I have tried a number of methods
to get TIMEVALUE to recognize the text time, but it never works (I have tried
concatenating quote marks with the cell reference, etc.).

This should be easy (one would think!) -- how can I convert this fairly
straightforward text time into military time? I have searched this forum and
have not found this specific issue addressed. Thanks in advance for any help
you can offer.

Steve
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 353
Default TIMEVALUE - can I use cell reference as argument?

It's the lack of a space before the AM and PM that's messing you up.
If the date is in cell A2, this will fix that problem:
=TIMEVALUE(LEFT(A2,LEN(A2)-2)&" "&RIGHT(A2,2))
Adjust and copy as needed.

"Steve Vincent" wrote:

I need to convert a time that I import as text into military time. The time
format is hh:mm:ssPM/AM (in other words, the times in text appear as
01:25:23AM , 02:34:11PM , 11:54:01AM , 03:51:13PM , etc. ).

When I try to use TIMEVALUE, I get the #VALUE! error. It appears that the
argument for TIMEVALUE must be in quotes. I have tried a number of methods
to get TIMEVALUE to recognize the text time, but it never works (I have tried
concatenating quote marks with the cell reference, etc.).

This should be easy (one would think!) -- how can I convert this fairly
straightforward text time into military time? I have searched this forum and
have not found this specific issue addressed. Thanks in advance for any help
you can offer.

Steve

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default TIMEVALUE - can I use cell reference as argument?

the probelem may be the format it looks like there is no space between the 3
and the A in the 01:25:23AM
try somthing like
=timevalue(substitute(A1,"A"," A"))
you will probably need to embed this in an if statement saying whether you
have an A or P in the data
somehting like
=if(mid(A1,len(A1)-1,1)="A",timevalue(substitute(A1,"A","
A")),timevalue(substitute(A1,"P"," P"))



"Steve Vincent" wrote:

I need to convert a time that I import as text into military time. The time
format is hh:mm:ssPM/AM (in other words, the times in text appear as
01:25:23AM , 02:34:11PM , 11:54:01AM , 03:51:13PM , etc. ).

When I try to use TIMEVALUE, I get the #VALUE! error. It appears that the
argument for TIMEVALUE must be in quotes. I have tried a number of methods
to get TIMEVALUE to recognize the text time, but it never works (I have tried
concatenating quote marks with the cell reference, etc.).

This should be easy (one would think!) -- how can I convert this fairly
straightforward text time into military time? I have searched this forum and
have not found this specific issue addressed. Thanks in advance for any help
you can offer.

Steve

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default TIMEVALUE - can I use cell reference as argument?

=--SUBSTITUTE(SUBSTITUTE(A1,"AM"," AM"),"PM"," PM")


"Steve Vincent" wrote:

I need to convert a time that I import as text into military time. The time
format is hh:mm:ssPM/AM (in other words, the times in text appear as
01:25:23AM , 02:34:11PM , 11:54:01AM , 03:51:13PM , etc. ).

When I try to use TIMEVALUE, I get the #VALUE! error. It appears that the
argument for TIMEVALUE must be in quotes. I have tried a number of methods
to get TIMEVALUE to recognize the text time, but it never works (I have tried
concatenating quote marks with the cell reference, etc.).

This should be easy (one would think!) -- how can I convert this fairly
straightforward text time into military time? I have searched this forum and
have not found this specific issue addressed. Thanks in advance for any help
you can offer.

Steve

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
timevalue function busterpace Excel Worksheet Functions 2 October 8th 06 03:39 AM
How do I enter a cell value into the Timevalue() function? busterpace Excel Worksheet Functions 1 October 8th 06 02:23 AM
TimeValue formula Phrank Excel Worksheet Functions 2 September 20th 06 10:27 AM
Using single cell reference as table array argument in Vlookup CornNiblet Excel Worksheet Functions 3 September 22nd 05 09:15 AM
OFFSET using ADDRESS for the reference argument TRE Excel Worksheet Functions 1 June 17th 05 01:33 PM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"