Concatenate two columns keeping date and time formatting

nailuss999

New Member
Joined
Feb 8, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi guys!
I have a column A that refers to dates in the custom format: "mm/dd/yyyy" and a column B that refers to times in the custom format: "hh:mm:ss". Well, I need to concatenate both columns and create a column C but keep the format of the previous ones.

Example: Column A: 01/25/2022 Column B: 08:45:00 Column C should read: 01/25/2022 08:45:00

I can't manage to concatenate them and get them in the right format, neither giving them a custom format like "mm/dd/yyyy hh:mm:ss".

Does anyone know how to solve this?

Thanks in advance colleagues!

Translated with www.DeepL.com/Translator (free version)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Just add the cells together with =A2+B2 & format the cell to show date & time.
 
Upvote 1
Maybe something like this:

VBA Code:
=CONCAT(TEXT(A1,"mm/dd/yyyy")," ",TEXT(B1,"hh:mm:ss"))
 
Upvote 1
Welcome to the Board!

Excel really stores dates as numbers, specifically the number of days since 1/0/1900 and time is just the fractional component of one day.

So, if your entries are true date and time entries (and not text), you can simply add the two values together, and just use apply a format of "mm/dd/yyyy hh:mm:ss" to the cell to get what you want.

EDIT: Just note the difference in replies and potential implications. The solutions Fluff and I posted will return valid date/time entries. Coyotex3's reply will return a Text value.
If you are trying to perform any sort of mathematical computation (or sorting) on the result, you will want valid/date time entry.
If it is for display purposes only, the method returning text would be fine.
 
Upvote 1
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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