Enter time date in excel in mm:ss format(just buy inputting numbers without the colon : and 0: hours in front)
Hi, I'm working on a project and need to calculate the number of minutes and seconds people worked on.
*I found a similar question but was wondering if I could make the format more simple. (Will explain at the bottom)
Not the issue is when input 38:14 meaning 38 minutes and 14 seconds the cell recognizes it as 38 hours and 14 minutes and if i double click it... this is what I get... 1900-01-01 2:14:00
I understand the reason why but I want a format that could recognize the numbers as minutes and seconds.
I found an answer that seems easy and simple but i can't figure out how to make it work...
"Peter Albert gave a solution in this link. I like his answer simple just need to follow simple directions and conpy and paste but it's not working for me"
here's his answer.
There is a solution! Place this VBA code in your worksheet module, i.e.:
Open the Visual Basic Editor (Alt-F11) In the top left treeview, double click on the sheet you want to enter your times In the central code panel, place the below code. Close VBE Use this code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value < 0 Or Target.Value > 1 And Target.NumberFormat <> "h:mm" Then Exit Sub
Application.EnableEvents = False
Target.Value = Target.Value / 60
Target.NumberFormat = "mm:ss"
Application.EnableEvents = True
End Sub
In case you already formatted the range you're entering the data in, use this line instead as the first line:
If Target.Value < 0 Or Target.Value > 1 Then Exit Sub
Note that this will change the value and format - every time you enter either a time - or something that is between 0 and 1! If you want to restrict it to a certain column, add this line:
If Target.Column <> 3 Then Exit Sub
or this line to restrict it to a certain range
If Intersect(Target, Range("A2:A100") Is Nothing Then Exit Sub
===================================================
*Now the version I like to have is when I input 4 digits I want the 2 first ones to be recognized as minutes and the two last ones as seconds... This would help me save time typing the : colon.
so when I input 3814 it would be recognized as 38 minute and 14 seconds in the cell it would be marked as 38:14 automatically.
of course, even if it passes 60 minutes I would want it to display minutes only.
The cells I want to apply the conditions are from G13 to G104.
Thank you in advance.
0:mm:ssand apply format as[m]:ss. If you want to convert4520as45:20(45 Minutes & 20 Seconds) the use this=LEFT(A1,2)&":"&RIGHT(A1,2). – Rajesh Sinha May 10 '20 at 07:27