Cell Formatting/Input Mask date as text with AM/PM

jpsanicky

New Member
Joined
Sep 22, 2018
Messages
14
Greetings,
I need to format cells to input a time and am or pm using numbers and letters.
1030a to return 10:30AM
530p to return 5:30PM
Uppercase if possible.
I am using #":"## to return a military format. 1825 returns 18:25.
I can use this format with this formula to aid in making calculations between start and stop times. =--TEXT(C10,"00\:00")
When I try to add other items to the mask, I get errors, or it doesn't work.
#":"##_@"m" This yields 10:30 m I need to get the a in there, too.
Thanks,
Jerry
 
If you format the cells as hh:mm AM/PM
When you enter the time using a colon as the divider i..e 10:30 it will show as 10:30 AM. and 15:30 as 15:30PM
 
Upvote 0
Greetings,
I need to format cells to input a time and am or pm using numbers and letters.
1030a to return 10:30AM
530p to return 5:30PM
Uppercase if possible.
I am using #":"## to return a military format. 1825 returns 18:25.
I can use this format with this formula to aid in making calculations between start and stop times. =--TEXT(C10,"00\:00")
When I try to add other items to the mask, I get errors, or it doesn't work.
#":"##_@"m" This yields 10:30 m I need to get the a in there, too.
Thanks,
Jerry
Or do you want something like this:
autofilterTest.xlsm
FG
1Enter TimeOutput
21030a10:30 AM
Sheet1
Cell Formulas
RangeFormula
G2G2=IF(LEN(F2)=5,LEFT(F2,2)&":"&MID(F2,3,2)&" "&IF(RIGHT(F2,1)="a","AM","PM"),LEFT(F2,1)&":"&MID(F2,2,2)&" "&IF(RIGHT(F2,1)="a","AM","PM"))
 
Upvote 0
Bradley S
Thanks for the response.
Ideally, I want all the input masks to be in the same cell. This way, the user doesn't have to worry about typing a ":".
Enter a time as 1030a and get 10:30 AM in the same cell.

If this is not possible, then that's what it will be.

Using the format of #":"## when entering 24-hour time, I get the correct format 1030 = 10:30 and 2210 - 22:10, and I can run calculations against the data.
Maybe I can use your example in an input cell and mask the input values when entered with conditional formatting.
I want to avoid using too much code in this project.
Jerry
 
Upvote 0
Bradley S
Thanks for the response.
Ideally, I want all the input masks to be in the same cell. This way, the user doesn't have to worry about typing a ":".
Enter a time as 1030a and get 10:30 AM in the same cell.

If this is not possible, then that's what it will be.

Using the format of #":"## when entering 24-hour time, I get the correct format 1030 = 10:30 and 2210 - 22:10, and I can run calculations against the data.
Maybe I can use your example in an input cell and mask the input values when entered with conditional formatting.
I want to avoid using too much code in this project.
Jerry
That will require VBA code, if you want it to function within the same input cell.
 
Upvote 0

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