Excel help please! ...
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

[Closed] Excel help please! Time stuff..

14 Posts
10 Users
0 Reactions
79 Views
Posts: 2871
Full Member
Topic starter
 

I have a spread sheet that has some times in it. Some of the times have been entered as 4 fig numbers "1230" not as "12:30"

How can I get excel either convert the times to the correct format, or recognise the 4 fig numbers as times.

I'm going to put data validation on the cells to stop the other numpties doing this in future...


 
Posted : 04/06/2015 11:56 am
Posts: 17
Free Member
 

Find the person who did it, explain their mistake tell them to fix it.


 
Posted : 04/06/2015 12:00 pm
Posts: 2871
Full Member
Topic starter
 

I've tried that. They look at me as though I have two heads and don't seem to understand how useless they are.


 
Posted : 04/06/2015 12:05 pm
Posts: 0
Free Member
 

if cell containing time = A2

=if(len(A2)=4,left(A2,2)&":"&right(a2,2),a2)

copy, paste special, values
highlight column, text to columns, finish
change formatting for column to time


 
Posted : 04/06/2015 12:07 pm
 lerk
Posts: 185
Free Member
 

I always have time inputs as HHMM format, then do a conversion on that in the background.

Once you've sorted the HHMM problem, you'll no doubt have to solve the HH.MM, HH;MM and HH,MM problem too!


 
Posted : 04/06/2015 12:10 pm
Posts: 17
Free Member
 

not forgetting the HMM, HM and any other combination probably including some text ones...


 
Posted : 04/06/2015 12:12 pm
Posts: 9834
Full Member
 

Make a table of numpty input verses correct out put

1230 12:30
1231 12:31

then use vlookup

But I think that you want to find and replace, not add a column. That would need a macro

The table could contain other options like comma seperator


 
Posted : 04/06/2015 12:12 pm
Posts: 722
Full Member
 

it depends on how they've written the times, have they used 24hrs? i.e. 1345 not 145?

if 24hrs:
cell containing time = A1
=IF(LEN(A1)=3,((LEFT(A1,1)&":"&RIGHT(A1,2))),((LEFT(A1,2)&":"&RIGHT(A1,2))))

this will take into account if am times have been entered as 3 digits e.g. 930, then highlight column, copy and paste special values, set format as time


 
Posted : 04/06/2015 12:15 pm
Posts: 2871
Full Member
Topic starter
 

@ DougD and Rondo

I get what you've both done there! thanks I'll figure out how to handle the number from your suggestions. Fortunately they are all 4 figure 24hrs format numbers.


 
Posted : 04/06/2015 12:40 pm
Posts: 3614
Full Member
 

Also use data validation on the input cells, so in future they will have to enter it in the correct format.


 
Posted : 04/06/2015 12:48 pm
Posts: 1361
Free Member
 

=time(hour(left(a1,2)),minute(right(a1,2),0)

that'll just drop it straight into time format without having to paste anything more


 
Posted : 04/06/2015 12:50 pm
Posts: 17851
Full Member
 

I don't think you want "hour" and "minute" in there. Just
=TIME(LEFT(A1,2),RIGHT(A1,2),0)

Oh and if you want 24 hour clock, check the cell format is hh:mm


 
Posted : 04/06/2015 1:47 pm
Posts: 1361
Free Member
 

@slowoldman you're right, i'm used to pulling times out of the serial number in excel and put that in on autopilot
OP - what Slowoldman did right there will do you


 
Posted : 04/06/2015 1:58 pm
Posts: 0
Free Member
 

Change the input cells to limit what users can enter.

Use data validation so users pick an hour value from a drop-down list in one cell and minutes from a drop-down list is another cell.
Can then concatonate the two and format it however is required.


 
Posted : 04/06/2015 2:00 pm
Posts: 2871
Full Member
Topic starter
 

Thank you all. Now I feel a bit more knowledgucated about the TIME, LEFT and RIGHT functions. Stand well back while I use this to devastating effect.


 
Posted : 05/06/2015 7:44 pm