Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate time

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
0
0
US
I have 2 cells that contain times. one has, for example, 1:00 pm and one has 8:00 pm. I am trying to concatenate them into one cell looking like this 1:00 pm - 8:00pm. I cannot seem to get this to give the desired results. Any help is appreciated.
 
hi,

Assuming that your two cells are A1 & B1...
[tt]
=TEXT(A1,"[highlight #8AE234]hh:mm am/pm[/highlight][highlight #8AE234][/highlight]")&" - "&TEXT(B1,"hh:mm am/pm")
[/tt]

The reason for converting Time Values to TEXT is because time is a fractional number.
1:00 PM is 13/24 = 0.541666666666667. That is the actual value in your cell. What you see displayed is a [highlight #8AE234]Number Format[/highlight] for Time in your cell. If you were to change the Number Format to GENERAL, you would see tha actual value. Changing a Number Format does nothing to the actual value in the cell. It just changes what you see displayed in the cell.

Bottom line, you need the NUMBER displayed as a TEXT string in TIME FORMAT in order to be able concatenate with other TEXT values.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Unless your "2 cells that contain times" actually contain text that you interpret as time. In which case your formula would be simply:[tt]
=A1&" - "&B1 [/tt]


---- Andy

There is a great need for a sarcasm font.
 
I cannot seem to get this to give the desired results.

Well it would have helped had the OP stated...
[ul]
[li]the formula the OP had used and[/li]
[li]the results the OP had observed.[/li]
[/ul]

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top