Output format of time

ttamers

New Member
Joined
Oct 6, 2014
Messages
2
I have an excel sheet that has information in the following format
[TABLE="width: 500"]
<tbody>[TR]
[TD]09/17/14[/TD]
[TD]5:58a[/TD]
[TD]11:31a[/TD]
[/TR]
[TR]
[TD]09/17/14[/TD]
[TD]12:02p[/TD]
[TD]2:34p[/TD]
[/TR]
</tbody>[/TABLE]

What formula can I use so the output is an AM / PM - please note there is NO space between the time and the a or the p.
This is how I would like the sheet to look - I will also be formating this sheet further so this needs to be standard times.
[TABLE="width: 500"]
<tbody>[TR]
[TD]09/17/14[/TD]
[TD]5:58 am[/TD]
[TD]11:31 am[/TD]
[/TR]
[TR]
[TD]09/17/14[/TD]
[TD]12:02 pm[/TD]
[TD]2:34 pm[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi and Welcome to MrExcel,

Typically it's best to use serial time values instead of text strings that that looks like time values. Then formatting can be applied to the cells to display the time in your desired format.

That allows you to more easily perform mathematical operations using those values. Assuming your current values are simply text strings, the formula below could be used to convert them to serial time values.

Both B4 and B7 use the same formula to convert the text string in B1 to a serial time value.
Range B7:C8 has had this Custom Formatting applied:
h:mm a/p"m"


Excel 2013
ABC
19/17/20145:58a11:31a
29/17/201412:02p2:34p
3
49/17/20140.2486110.479861
59/17/20140.5013890.606944
6
79/17/20145:58 am11:31 am
89/17/201412:02 pm2:34 pm
Sheet1
Cell Formulas
RangeFormula
B4=TIMEVALUE(SUBSTITUTE(SUBSTITUTE(B1,"a"," a"),"p"," p"))
B7=TIMEVALUE(SUBSTITUTE(SUBSTITUTE(B1,"a"," a"),"p"," p"))
 
Last edited:
Upvote 0
Thank you worked perfect!



Hi and Welcome to MrExcel,

Typically it's best to use serial time values instead of text strings that that looks like time values. Then formatting can be applied to the cells to display the time in your desired format.

That allows you to more easily perform mathematical operations using those values. Assuming your current values are simply text strings, the formula below could be used to convert them to serial time values.

Both B4 and B7 use the same formula to convert the text string in B1 to a serial time value.
Range B7:C8 has had this Custom Formatting applied:
h:mm a/p"m"

Excel 2013
ABC
5:58a11:31a
12:02p2:34p

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"]9/17/2014[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]9/17/2014[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]9/17/2014[/TD]
[TD="bgcolor: #FFFF00, align: right"]0.248611[/TD]
[TD="align: right"]0.479861[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]9/17/2014[/TD]
[TD="align: right"]0.501389[/TD]
[TD="align: right"]0.606944[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]9/17/2014[/TD]
[TD="bgcolor: #FFFF00, align: right"]5:58 am [/TD]
[TD="align: right"]11:31 am [/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]9/17/2014[/TD]
[TD="align: right"]12:02 pm [/TD]
[TD="align: right"]2:34 pm [/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]B4[/TH]
[TD="align: left"]=TIMEVALUE(SUBSTITUTE(SUBSTITUTE(B1,"a"," a"),"p"," p"))[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]B7[/TH]
[TD="align: left"]=TIMEVALUE(SUBSTITUTE(SUBSTITUTE(B1,"a"," a"),"p"," p"))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,226,729
Messages
6,192,696
Members
453,747
Latest member
tylerhyatt04

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top