PineNuts0
PineNuts0

Reputation: 5234

Google Sheets: Combining Dates From Two Different Columns into Third Column W/Proper Date Formatting

I have two columns. One contains start date and the other contains end date in the following format: YYYY-MM-DD

I'm trying to create a third column that combines the two dates to produce: "YYYY-MM-DD to YYYY-MM-DD"

I tried the following formula: =M2&" to "&N2

But it gives me back the dates in numbers like so (but I want the dates): 45047 to 45074

Any suggestions on how to fix my issue?

Upvotes: 0

Views: 289

Answers (2)

Blindspots
Blindspots

Reputation: 1014

  1. Dates are simply numbers displayed in a cell with date-formatting applied.
  2. Your formula works with the underlying number.
  3. Apply your preferred "date format" to the numbers using the TEXT function.
  4. This has the added benefit of addressing any minor or major differences between the date formating in your spreadsheet (ie "mm/dd/yyyy" vs. "mm/d/yyyy" vs. "mmm/dd/yyyy" vs. "#", etc.
=TEXT(M2, "YYYY-MM-DD") &
   " to " &
   TEXT(N2, "YYYY-MM-DD")

Upvotes: 0

rockinfreakshow
rockinfreakshow

Reputation: 29878

You may try:

=to_text(M2)&" to "&to_text(N2)

Upvotes: 0

Related Questions