Combining dates and times

kweaver

Well-known Member
Joined
May 12, 2009
Messages
2,934
Office Version
  1. 365
  2. 2010
This has always been a nightmare for me.
It's causing all kinds of issues with another situation I posted. Maybe this will help me resolve it.

Book1
DEF
1402/21/202211:00 AM2/26/2022 11:00
1502/21/202201:00 PM2/26/2022 13:00
1602/21/202201:00 PM3/6/2022 13:00
1702/21/202209:00 PM3/6/2022 21:00
1802/22/202209:00 PM3/15/2022 21:00
1902/22/202205:00 AM3/16/2022 5:00
2002/24/202205:00 AM3/26/2022 5:00
2102/24/202201:00 PM3/26/2022 13:00
2202/21/202208:00 AM2/21/2022 8:00
2302/21/202211:00 AM2/21/2022 11:00
Sheet1
Cell Formulas
RangeFormula
F14:F23F14=D14+E14


I thought date and time columns could be put together using + per the above. Clearly not because the dates are messed up.
Why did some of the dates jump to the next month?

How to I get one column to consist of the merge of the dates and times?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You should be able to normally it depends on how your times were generated. Your times have days in them eg the values aren't just the fraction they have a preceding integer.
If you are happy they represent just hours and mins then you can try this:
(be careful in that they may represent duration and not a time of day)
Excel Formula:
=D14+MOD(E14,1)

If you wanted play it really safe in case you have similar issues with the date
Excel Formula:
=INT(D14)+MOD(E14,1)
 
Last edited:
Upvote 0
Thanks, Alex...how did you see the preceding integer?

I will try your suggestions.

As a follow-up: If I have =D18+MOD(E18,1) how do I add 8 hours to that?
 
Last edited:
Upvote 0
Change the column format to general or paste special values.
It tends to happen automatically when you paste in XL2BB
 
Upvote 0
Date and Time 2021.xlsm
DEF
12Converted to DatesFormatted General
1321-Feb-20225.4583333321-Feb-2022 11:00 AM
14
13d
Cell Formulas
RangeFormula
F13F13=INT(D13)+MOD(E13,1)




Cell Formulas
RangeFormula
F14:F23F14=MOD(E14,1)
G14:G23G14=D14+F14
H14:H23H14=INT(D14)+MOD(E14,1)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

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