NUMBER TO TIME CONVERT

CJ

Board Regular
Joined
Feb 22, 2002
Messages
77
Hi guys, A nice simple one!!!!

I have imported some data into a spreadsheet
but the time has come across as a number
ie, 1630 instead of 16:30 (to many to do manually - 500+)

Can anyone advise me on a formula or a custom format to insert a colon in the number two places in from the right

CHRIS
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Thank Brain

Tried what you mentioned but it won't accept it as a format!!!

CHRIS
 
Upvote 0
On 2002-03-21 17:30, BabyTiger wrote:
Alternatively, using Brian's method, but instead of "00:00", use "hh:mm"

Hi Baby Tiger:
I was trying to follow what you meant, but I am not getting what tou meant. Brian's FORMAT|CELLS|NUMBER..."Custom 00:00" sans quotes works for me!
 
Upvote 0
Using the format I gave, I'm trying to subtract the time.

11:59-13:00=61Mins.
Answer I get is 1:41
Anyone have any ideas?

Mahalo...Brian
 
Upvote 0
Hi Brian
You could use an if statement that goes along the lines if A>=B then A-B else B-A.
regards
Derek
 
Upvote 0
Derek,

In my situation, A1 will always be less than B1 as I'm using a 24 hour format unless we past midnight, but never so far. I got his custom format because I didn't want to type 12:00 but 1200 with the colon inserted by the custom format. But I can't get it to subtract properly. i.e. 11:59 and 13:00 to :61.
 
Upvote 0
Brian
That's because the format you are using gives the appearance of time but the colon actually acts as a decimal point, so you are subtracting decimals not time.
I had a similar problem where I needed to enter 4 digit time in a time calculator.
I overcame it using hidden columns that were formatted [h]:mm
Try this:
Custom Format A1:B1 as 0000
Custom Format C1:E1 as [h]:mm
in A1 type 1159
in B1 type 1300
in C1 put formula =LEFT(A1,2)&":"&RIGHT(A1,2)
In D1 put formula =LEFT(B1,2)&":"&RIGHT(B1,2)
In E1 put formula =D1-C1
You can then hide columns C:D
Since time format won't allow negative time, you may have to revert to using the if function to take the smaller time from the larger, if this is an issue.

hope this helps
regards
Derek
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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