Vba to combine date and time

Eean

New Member
Joined
May 26, 2010
Messages
44
Hi,
I think there's an easy answer to this one but I can't work it out.
I have a range of data where A2 = a date in (dd/mm/yy) and B2 has the time in (hh:mm:ss).
What's the best way to take the times from Column B and add them to Column A's data in (dd/mm/yy hh:mm:ss)
Thanks in advance,

Ian.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Excel stores dates/times as numbers where the integer part is the date and the fractional part is the time. To combine the two columns, use =int(a2) + (b2 - int(b2)).
 
Upvote 0
If A2 is just a date and B2 is just a time, then you should be able to add them directly:
=A2+B2

It may be that you need to format the resulting column as dd/mm/yy hh:mm:ss
 
Upvote 0
When I use that formula:

A1 = 11/6/2013

B1= 23:16:15

G1(formula cell) is showing as 6/12/2013 08:28:43?
 
Upvote 0
I missed the title information that you were looking for vba.
If that is still required, tell us more about how much data you have, where is is, and where the result(s) should go.
 
Upvote 0
If A2 is just a date and B2 is just a time, then you should be able to add them directly:
=A2+B2

It may be that you need to format the resulting column as dd/mm/yy hh:mm:ss

I think this will work for me, It's only a fraction of the data that I need to compile that has been collated in a different format.
Thanks so much!
Ian.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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