Date: 16/05/2019 21:40:30
From: mollwollfumble
ID: 1387722
Subject: Excel question

I have date and time in five columns as follows:

Month, Day, AM Hr, PM Hr, Minute.
4, 25, , 4, 30

I can change to 24 hr system by adding 12 to PM Hr.

How can I change that to a date:time format like
4/25:16:30

Reply Quote

Date: 16/05/2019 21:54:09
From: The Rev Dodgson
ID: 1387733
Subject: re: Excel question

mollwollfumble said:


I have date and time in five columns as follows:

Month, Day, AM Hr, PM Hr, Minute.
4, 25, , 4, 30

I can change to 24 hr system by adding 12 to PM Hr.

How can I change that to a date:time format like
4/25:16:30

With data in columns A to E
=A6&”/”&B6&”:”&(C6+D6+IF(D6>0,12,0))&”:”&E6

4/25:16:30

Reply Quote

Date: 16/05/2019 22:02:01
From: mollwollfumble
ID: 1387738
Subject: re: Excel question

The Rev Dodgson said:


mollwollfumble said:

I have date and time in five columns as follows:

Month, Day, AM Hr, PM Hr, Minute.
4, 25, , 4, 30

I can change to 24 hr system by adding 12 to PM Hr.

How can I change that to a date:time format like
4/25:16:30

With data in columns A to E
=A6&”/”&B6&”:”&(C6+D6+IF(D6>0,12,0))&”:”&E6

4/25:16:30


Thanks rev!
I think I found a different answer here, using custom format d/mm:h:mm
=(C4+IF(D4>0,D4+12,0))/24+E4/(24*60)+B4+(A4-1)*30+1

But yours is nicer.

Reply Quote

Date: 16/05/2019 22:08:25
From: The Rev Dodgson
ID: 1387744
Subject: re: Excel question

mollwollfumble said:


The Rev Dodgson said:

mollwollfumble said:

I have date and time in five columns as follows:

Month, Day, AM Hr, PM Hr, Minute.
4, 25, , 4, 30

I can change to 24 hr system by adding 12 to PM Hr.

How can I change that to a date:time format like
4/25:16:30

With data in columns A to E
=A6&”/”&B6&”:”&(C6+D6+IF(D6>0,12,0))&”:”&E6

4/25:16:30


Thanks rev!
I think I found a different answer here, using custom format d/mm:h:mm
=(C4+IF(D4>0,D4+12,0))/24+E4/(24*60)+B4+(A4-1)*30+1

But yours is nicer.

OTOH using a custom format means you have the date as a day number, which can be useful.

It would also be pretty easy to do as a user defined function in VBA.

Reply Quote

Date: 16/05/2019 22:14:12
From: mollwollfumble
ID: 1387747
Subject: re: Excel question

mollwollfumble said:


The Rev Dodgson said:

mollwollfumble said:

I have date and time in five columns as follows:

Month, Day, AM Hr, PM Hr, Minute.
4, 25, , 4, 30

I can change to 24 hr system by adding 12 to PM Hr.

How can I change that to a date:time format like
4/25:16:30

With data in columns A to E
=A6&”/”&B6&”:”&(C6+D6+IF(D6>0,12,0))&”:”&E6

4/25:16:30


Thanks rev!
I think I found a different answer here, using custom format d/mm:h:mm
=(C4+IF(D4>0,D4+12,0))/24+E4/(24*60)+B4+(A4-1)*30+1

But yours is nicer.

PMSL, I tried your formula in Excel (cut and paste) and it didn’t work … Until I realised that for some odd reason it was writing in white font on a white background! Works perfectly now.

Reply Quote

Date: 16/05/2019 22:30:32
From: mollwollfumble
ID: 1387762
Subject: re: Excel question

Pain diary is now starting to take shape.

!!

In case you’re wondering when I sleep …

Reply Quote

Date: 17/05/2019 08:09:40
From: The Rev Dodgson
ID: 1387812
Subject: re: Excel question

mollwollfumble said:


PMSL, I tried your formula in Excel (cut and paste) and it didn’t work … Until I realised that for some odd reason it was writing in white font on a white background! Works perfectly now.

If you do a straight cut and paste from here you also paste the font and text colour, but not background colour, so you end up with white on white.

You have to paste-special and select text only.

Reply Quote

Date: 17/05/2019 08:10:31
From: poikilotherm
ID: 1387813
Subject: re: Excel question

The Rev Dodgson said:


mollwollfumble said:

PMSL, I tried your formula in Excel (cut and paste) and it didn’t work … Until I realised that for some odd reason it was writing in white font on a white background! Works perfectly now.

If you do a straight cut and paste from here you also paste the font and text colour, but not background colour, so you end up with white on white.

You have to paste-special and select text only.

Where’s the Any key?

Reply Quote

Date: 17/05/2019 08:12:25
From: furious
ID: 1387814
Subject: re: Excel question

Or paste it directly in the, what do you call it, formula bar at the top…

Reply Quote

Date: 17/05/2019 08:35:44
From: The Rev Dodgson
ID: 1387823
Subject: re: Excel question

furious said:

  • You have to paste-special and select text only.

Or paste it directly in the, what do you call it, formula bar at the top…

Yeah, that would be the quickest way.

Reply Quote