Hi there in excel when you custom time ie hh.mm when I input it it doesn’t do what I type any ideas please
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
help with time in excel
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » help with time in excel
- This topic has 22 replies, 6 voices, and was last updated 9 years, 10 months ago.
Viewing 14 reply threadsAuthorReplies-
RetiredGeek
AskWoody_MVPJune 26, 2015 at 10:17 am #1512143Mar27,
Ok your custom format has a period (.) between the hours & minutes. However, when you enter the value you must use the colon[noparse] (:)[/noparse] between the minutes and seconds for Excel to recognize that you are entering a time. If you do this the time will display as 10.45 even though you entered it as 10:45. HTH :cheers:
-
WSmar27
AskWoody LoungerJune 26, 2015 at 10:44 am #1512147Mar27,
Ok your custom format has a period (.) between the hours & minutes. However, when you enter the value you must use the colon[noparse] (:)[/noparse] between the minutes and seconds for Excel to recognize that you are entering a time. If you do this the time will display as 10.45 even though you entered it as 10:45. HTH :cheers:
I have done that which has worked on most of my sheet but when I input ie 57:00 I am getting this instead 02/01/1900 09:00:00
-
access-mdb
AskWoody MVPJune 26, 2015 at 11:01 am #1512154I have done that which has worked on most of my sheet but when I input ie 57:00 I am getting this instead 02/01/1900 09:00:00
This is correct as you now have 57 hours from 1 Jan 1900 at midnight. hh:mm (however formatted) is clock time not a count of hours and minutes.
The question is – what are you using the data for? If just displaying an elapsed time then formatting the cell as text will do the trick. It becomes a bit more complicated if you want to use the numbers in a calculation.
Eliminate spare time: start programming PowerShell
-
-
-
RetiredGeek
AskWoody_MVPJune 26, 2015 at 10:52 am #1512150Mar27,
Ok, I’m guessing you’re using the dd/mm/yyyy date format (European I’m guessing since you didn’t post your location).
57 Hours = 2 Days 9 Hours thus -> Counting from 1/1/1900 + 2 Days + 9 Hours = 2 Jan 1900 @ 09:00. HTH :cheers: -
WSmar27
AskWoody Lounger -
RetiredGeek
AskWoody_MVPJune 26, 2015 at 12:54 pm #1512171Mar27,
I’m a bit at a loss to understand your worksheet.
Row 26 shows 20 hours to fall asleep but only 7:19 in bed?
Could you please explain the logic between the columns as it will surely help with arriving at a solution.
BTW: You can use this formula to calculate time in bed. [noparse]=($A3+1+$C3)-($A3+$B3)[/noparse]
Place in cell G3 then fill down.HTH :cheers:
-
WSmar27
AskWoody Lounger -
WSX_LD
AskWoody Lounger -
WSmar27
AskWoody Lounger -
Paul T
AskWoody MVP -
WSmar27
AskWoody Lounger -
zeddy
AskWoody_MVPJune 27, 2015 at 9:47 am #1512299Hi Mar
I suspect what you really want is just an easy way to enter time values.
In my attached version you can enter 1, 2 , 3 or 4 digits
if you enter a single digit, it assumes it is hours. e.g 8 =>08:00
if you enter 2 digits, it assumes minutes e.g 57 => 00:57
if you enter a number with a decimal: left of decimal is treated as hours as follows:
20.3 =>20:30; 21.17 =>21:17; 8.25 =>08:25; 8.4 => 08.40
If you enter 3 digits, it is assumed to be hmm e.g. 625 =>06:25; 123 =>01:23; 755 =>07:55
if you enter 4 digits, it is assumed to be hhmm
..have a try, and see if this is what you wantzeddy
-
-
Paul T
AskWoody MVP -
WSmar27
AskWoody Lounger
-
-
WSX_LD
AskWoody Lounger -
access-mdb
AskWoody MVPJune 27, 2015 at 8:32 am #1512288I’ve just tried Paul’s suggestion and it displays as 57.00 (though when the focus is in that cell the contents are displayed above as 02/01/1900 09:00:00). Are you sure that you’ve entered the format correctly as he suggested?
X_LD, that doesn’t work as the OP requires. At least I get an answer of 1368:00….
Eliminate spare time: start programming PowerShell
-
WSmar27
AskWoody Lounger -
zeddy
AskWoody_MVP
-
-
access-mdb
AskWoody MVP -
zeddy
AskWoody_MVPJune 27, 2015 at 4:10 pm #1512338Hi access-mdb
..it works using the event code for the sheet (right-click on the sheet tabname, then select View Code)
Here is the code I used. It could be probably be improved, I just did it quickly:
Target is the cell that is changed (i.e. edited or entered) by the User.Code:Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub zRow = Target.Row zCol = Target.Column If zRow [h1].Column Then Exit Sub zValue = Target.Value Application.EnableEvents = False Select Case zCol Case [b1].Column, [c1].Column, [d1].Column, [g1].Column, [h1].Column If zValue Like "#" Then Target = zValue & ":00" 'single digit assumed to be hour If zValue Like "#." Then Target = zValue & ":00" 'assumed to be hour If zValue Like "##." Then Target = zValue & ":00" 'assmed to be hour If zValue Like "##" Then Target = "00:" & zValue 'assumed to be minutes If zValue Like "#.#" Then 'treat as h:m0 e.g. 4.3 => 04:30 zHr = Left(zValue, 1) zMin = Right(zValue, 1) Target = zHr & ":" & zMin & "0" End If If zValue Like "#.##" Then 'treat as h:mm e.g. 6.25 => 06:25 zHr = Left(zValue, 1) zMin = Right(zValue, 2) Target = zHr & ":" & zMin End If If zValue Like "##.#" Then 'treat as hh:m0 e.g. 17.3 => 17:30 zHr = Left(zValue, 2) zMin = Right(zValue, 1) Target = zHr & ":" & zMin & "0" End If If zValue Like "##.##" Then 'treat as hh:mm e.g. 12.55 => 12:55 zHr = Left(zValue, 2) zMin = Right(zValue, 2) Target = zHr & ":" & zMin End If If zValue Like "####" Then 'assume to be hhmm e.g. 2015 => 20:15 zHr = Left(zValue, 2) zMin = Right(zValue, 2) Target = zHr & ":" & zMin End If If zValue Like "###" Then 'assumed to be hmm e.g 725 => 07:25 zHr = Left(zValue, 1) zMin = Right(zValue, 2) Target = zHr & ":" & zMin End If Case Else End Select Application.EnableEvents = True End Sub
zeddy
-
-
access-mdb
AskWoody MVP -
zeddy
AskWoody_MVP
-
Viewing 14 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Blocking Search (on task bar) from going to web
by
HenryW
3 hours, 25 minutes ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
8 hours, 32 minutes ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
8 hours, 38 minutes ago -
regarding april update and may update
by
heybengbeng
10 hours, 8 minutes ago -
MS Passkey
by
pmruzicka
6 hours, 12 minutes ago -
Can’t make Opera my default browser
by
bmeacham
17 hours, 48 minutes ago -
*Some settings are managed by your organization
by
rlowe44
4 hours, 31 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
16 hours, 42 minutes ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 12 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
1 day, 21 hours ago -
AI slop
by
Susan Bradley
11 hours, 30 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
1 day, 22 hours ago -
Two blank icons
by
CR2
10 hours, 25 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
2 days, 7 hours ago -
End of 10
by
Alex5723
2 days, 10 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
1 day, 8 hours ago -
test post
by
gtd12345
2 days, 16 hours ago -
Privacy and the Real ID
by
Susan Bradley
2 days, 6 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
8 hours, 44 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
2 days, 20 hours ago -
Upgrading from Win 10
by
WSjcgc50
1 day, 8 hours ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day, 11 hours ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 12 hours ago -
The story of Windows Longhorn
by
Cybertooth
3 days ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 14 hours ago -
Are manuals extinct?
by
Susan Bradley
14 hours, 37 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
3 days, 23 hours ago -
Network Issue
by
Casey H
3 days, 10 hours ago -
Fedora Linux is now an official WSL distro
by
Alex5723
4 days, 11 hours ago -
May 2025 Office non-Security updates
by
PKCano
4 days, 11 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.