How to add time to a cell formatted as yyyymmddhhmmss

J

JD

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?
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top