JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
I would like to be able to format timestamps (date + time) so that both align but without leading zeroes for either. I do not see an easy way to do this. I will provide both a screenshot and a minisheet because the minisheets do not always preserve the look of the actual sheet, although this time it is pretty good.
Here's the minisheet.
- Column B has the time stamp formatted as "m/dd/yy h:mm AM/PM". The alignment of the dates is off.
- In Column C, I made the time field 9 characters regardless of the time, but apparently, spaces are not as wide as numbers in variable-spaced fonts,
- Column D uses a mono-spaced font. The alignment works, but has a different look.
- Column E solves the problem by changing to 24-hour time. The alignment works, but has a different look.
- Column F uses a Rube Goldberg solution that seems to work because the space character appears to be half as wide as the number characters.
Here's the minisheet.
Medical Logs.xlsx | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
2 | B | C | D | E | F | ||
3 | Date & Time | Format Try | Formatted Mono | Formatted 24 hr | 2 spaces = 1 | ||
4 | 12/12/23 10:30 PM | 12/12/23 10:30 PM | 12/12/23 10:30 PM | 12/12/23 22:30 | 12/12/23 10:30 PM | ||
5 | 2/03/24 6:03 AM | 2/03/24 6:03 AM | 2/03/24 6:03 AM | 2/03/24 06:03 | 2/03/24 6:03 AM | ||
6 | 3/28/24 11:44 AM | 3/28/24 11:44 AM | 3/28/24 11:44 AM | 3/28/24 11:44 | 3/28/24 11:44 AM | ||
MrExcel |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C4:D6 | C4 | =TEXT([@[Date & Time]],"m/dd/yy") & RIGHT(" " & TEXT([@[Date & Time]],"h:mm am/pm"),9) |
E4:E6 | E4 | =[@[Date & Time]] |
F4:F6 | F4 | =LET(time, TEXT([@[Date & Time]],"h:mm am/pm"), TEXT([@[Date & Time]],"m/dd/yy") & LEFT(" ",2*(9-LEN(time))) & time) |