ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to add time to a cell formatted as yyyymmddhhmmss (https://www.excelbanter.com/excel-worksheet-functions/97123-how-add-time-cell-formatted-yyyymmddhhmmss.html)

JD

How to add time to a cell formatted as yyyymmddhhmmss
 
How can a number of hours be added to a cell and both the time and date
increment correctly?

For example, A1 = 25, B1 = 0:00:00. I want to add A1 and B1 to get C1.
The Custom format for C1 is yyyymmddhhmmss. Both the time and date
need to change correctly.

I'm using the following function in C1: B1 + TIME(A1,0,0)

I realize I probably need a date function too but I do not know which
one or how to use it to do what I need.

The time is incremented correctly (0:59:00), but the date is incorrect.
The date is 01/01/1900 but should be 01/02/1900.

Any ideas?


Chip Pearson

How to add time to a cell formatted as yyyymmddhhmmss
 
When you use the TIME function, it will automatically roll-over
hours at 24:00:00. Thus TIME(25,0,0) gets rolled over to be the
equivalent of TIME(1,0,0).

Try

=B1+(A1/24)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"JD" wrote in message
oups.com...
How can a number of hours be added to a cell and both the time
and date
increment correctly?

For example, A1 = 25, B1 = 0:00:00. I want to add A1 and B1 to
get C1.
The Custom format for C1 is yyyymmddhhmmss. Both the time and
date
need to change correctly.

I'm using the following function in C1: B1 + TIME(A1,0,0)

I realize I probably need a date function too but I do not know
which
one or how to use it to do what I need.

The time is incremented correctly (0:59:00), but the date is
incorrect.
The date is 01/01/1900 but should be 01/02/1900.

Any ideas?





All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com