Calculation Issues

Combine Date and Time Columns in Excel with a Formula or VBA

Rana GarciaRana Garcia Dec 2, 2026 868 views

Question details

Combine dates and times from separate Excel columns into timestamps formatted as yyyy-mm-dd hh:mm:ss.

Combine Date and Time Columns in Excel with a Formula or VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet has dates and times in separate columns, and each row needs a combined timestamp.
Observed behavior
The desired output is one date-and-time value per row, displayed with seconds.
Before you start

Check that the date and time cells contain numeric Excel date and time values rather than text. Confirm that the time cells do not include an unwanted date component.

Solution 1Recommended

Add the date and time cells with a formula

Use this method to combine values in a worksheet without a macro.

Excel stores dates and times as serial numbers, so adding a date value to a time value produces a combined timestamp.

1
Enter the formula

If the date is in A2 and the time is in B2, select C2 and enter =A2+B2.

2
Fill the remaining rows

Drag the fill handle from C2 down through the rows containing dates and times.

3
Apply the timestamp format

Select the output cells, open Format Cells, choose Number > Custom, and enter yyyy-mm-dd hh:mm:ss in the Type box.

Add the date and time cells with a formula
Display versus value: The custom format changes how the timestamp appears; the underlying result remains a numeric date-and-time value.
Combine timestamps in WPS Spreadsheet

Combine date and time columns in WPS Spreadsheet

Use a simple addition formula and a custom number format in WPS Spreadsheet to create one timestamp per row.

  1. 1. Open the worksheet: Open your workbook in WPS Spreadsheet and locate the date and time columns.
  2. 2. Add the values: In an empty output cell such as C2, enter =A2+B2, adjusting the references to match your worksheet.
  3. 3. Fill the formula: Drag the fill handle down the output column to combine the remaining rows.
  4. 4. Format the results: Select the output cells, open Format Cells, choose Custom, and enter yyyy-mm-dd hh:mm:ss.
Combine separate date and time values with a worksheet formula.Display timestamps in yyyy-mm-dd hh:mm:ss format.Open and edit Microsoft Excel XLSX files.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the combined result appear as a number?

Excel stores dates and times as serial numbers. Select the result cells, open Format Cells > Number > Custom, and apply yyyy-mm-dd hh:mm:ss.

What if the formula returns a value error?

Check whether the source cells contain text instead of numeric dates or times. Convert text dates or times to Excel values before using =A2+B2.

Can I combine a whole column without VBA?

Yes. Enter =A2+B2 in the first output cell, then drag its fill handle down to apply the formula to the other rows.

What happens if a time cell also contains a date?

Adding the full time-cell value also adds its date portion. If you only need its time of day, use =A2+MOD(B2,1), then apply the custom timestamp format.