How to Sort a Row by Date in Google Sheets Safely

How-to basics · Updated November 3, 2026

How to Sort a Row by Date in Google Sheets Safely

To sort dates arranged left to right in Google Sheets, use a formula that transposes the selected range, sorts it by its first column, then transposes it back. For dates in A1:Z1, enter =TRANSPOSE(SORT(TRANSPOSE(A1:Z1),1,TRUE)) in an empty area. If each date heads a column of related information, include those rows in the range so the records move with the dates. Google Sheets sorts rows directly, but it does not offer Excel’s built-in “sort left to right” option.

What You’ll Need

  • A Google Sheets file opened in a web browser, with the dates and any related information arranged in columns.
  • A blank area large enough for the sorted result. For example, sorting A1:Z5 needs space for 5 rows and 26 columns.
  • Dates stored as actual date values, rather than text that only looks like dates. You can check a date cell by selecting it and looking at its value in the formula bar.
  • Permission to edit the spreadsheet if you plan to replace the original data with the sorted result.

Step-by-Step

  1. Identify the date row and the data that belongs with it. If dates run across row 1 and each column contains a related record, note the full rectangular range, such as A1:Z5. The dates should be the first row of that range, and every row beneath them should contain the corresponding information in the same columns. Sorting only the date row would change the dates but leave names, amounts, or other details where they were.
  2. Check that the dates are real date values. Select a few cells and confirm that they behave like dates: changing the display format through Format > Number > Date should show a date, and date cells should generally align to the right by default. Alignment can be changed manually, so it is only a clue. If a date is stored as text, sorting may follow text order rather than calendar order. Correct text dates before proceeding.
  3. Choose an empty output area. Leave enough clear cells for the whole result to spill without overwriting anything. For a single row, choose an empty row with the same number of columns. For a multirow block, allow the same number of rows and columns as the source. Do not place the formula inside the source range: the output needs room to expand, and overlapping it can trigger an error.
  4. Enter the formula for a single row of dates. If the dates are in A1:Z1, click the first cell of the blank output row and enter =TRANSPOSE(SORT(TRANSPOSE(A1:Z1),1,TRUE)). Press Enter. The inner TRANSPOSE turns the horizontal row into a vertical list, SORT orders that list by its first column in ascending order, and the outer TRANSPOSE returns the sorted dates to a horizontal row. Replace A1:Z1 with the actual range that contains your dates.
  5. Include related rows when entire records must move together. If dates are in A1:Z1 and the associated details occupy rows 2 through 5, use the whole range A1:Z5 in the formula: =TRANSPOSE(SORT(TRANSPOSE(A1:Z5),1,TRUE)). Put it in a blank area. The transposed range has one row per original column; SORT uses the first column, which contains the dates, to rearrange those rows. The final TRANSPOSE restores the original layout, keeping each date and its column data together.
  6. Review the sorted output before changing the source. Check that the earliest date is at the left and the latest at the right. Then compare at least two records with the original to confirm that each set of details stayed under its date. If the result is backwards, change the final argument in SORT from TRUE to FALSE to sort in descending order, with the latest dates first.
  7. Replace the original only if you need a fixed, editable result. Once the formula output is correct, select and copy the complete result. Select the original top-left cell, then use Edit > Paste special > Values only. This pastes the displayed values instead of formulas. Keep a copy of the original range or use Undo immediately if the pasted result is not as expected. If you want the result to keep updating when the source changes, leave the formula output in place instead.
  8. Sort by a different date row, if necessary. The formula sorts by the first row in the selected range. If the dates are on row 3, for example, make row 3 the first row of the range you transpose and sort. Do not include unrelated rows above the dates, such as a title or descriptive header, because that would make the formula sort by the wrong values.

Common Mistakes

Sorting only the dates when columns contain records: This separates dates from the names, values, or notes that belong to them. Include the entire data block in the formula range, with the date row at the top. If the records are spread across different ranges, first arrange them into one consistent rectangular block or use the helper-range method described in Tips.

Using dates that are text: Entries such as 03/04/2025 can be ambiguous, and pasted dates may remain text. Sheets can then sort by character order or interpret the date differently from what you intended. Check the spreadsheet locale under File > Settings if the month and day seem reversed, and convert text entries into valid dates before sorting.

Including a title or a non-date header in the sorted range: The formula sorts by the first row of the range. A text label in that row cannot act as a date key, and including an extra title row changes the sort key. Select a block whose first row is the row of dates.

Putting the formula where the result needs to spill: The formula returns multiple cells, not just one. Any existing content in the output area can prevent it from expanding. Clear enough cells first, and check for merged cells in the destination if the formula reports an expansion error.

Expecting the result to update the original cells: The formula creates a sorted copy; it does not rearrange its source. This is useful for checking the order safely. To make the sort permanent, copy the result and paste values over the original only after confirming that the complete records are correct.

Tips

  • Keep an untouched source copy. Duplicate the sheet by right-clicking its tab and choosing Duplicate, or copy the source range to another part of the file before replacing it. This makes it easier to recover if you miss a row or discover that some entries were not real dates.
  • Use descending order for newest-first timelines. In either formula, the third argument of SORT controls direction: TRUE means ascending and FALSE means descending. Ascending puts earlier dates first; descending puts later dates first.
  • Leave empty date columns out if practical. Blank dates can end up grouped at an edge of the sorted result and may make the output harder to interpret. Remove unused columns from the selected range, or decide how you want blank-date records handled before sorting.
  • Use a temporary helper range for a visual workflow. Copy the full block, then choose Edit > Paste special > Transposed in an empty area. The dates will be in the first column, with each original column’s associated values on the same row. Select the transposed block and use Data > Sort range > Advanced range sorting options; choose the first column as the sort key and select A to Z or Z to A. Copy the sorted helper block and transpose it back into a separate empty area to restore the horizontal layout. Verify the result before replacing the source.
  • Know the Excel difference. In desktop Excel, Data > Sort > Options includes a “Sort left to right” choice. Google Sheets in a browser does not provide that equivalent horizontal sort setting in its standard sort dialog, which is why a transpose-and-sort formula or helper range is useful here.
  • Consider whether dates are headings or values. If dates are in a column rather than a row, the usual Google Sheets Data > Sort range controls may be simpler. Select the full table and choose the date column as the sort key so entire records stay together.

Troubleshooting

The formula shows an error instead of a result: Make sure the destination has enough empty cells to hold the output and does not overlap the source. Check that the range address is valid and that no merged cells block the output. In some spreadsheet locales, formulas use semicolons instead of commas between arguments; if Sheets flags the separators, use the separator your file expects.

The dates appear in an unexpected order: First confirm that the cells contain actual dates and not text. Then check the spreadsheet locale and inspect dates with ambiguous formats, such as 04/05/2025. If you want newest-first order, use FALSE as the third SORT argument. If only part of the data changed position, expand the range to include every row that belongs to each date.

Some columns do not stay together: The selected range is probably too narrow or does not include every associated row. Rebuild the formula using the complete rectangle, with the date row first. Make sure every column in that rectangle represents one record; blank spacer columns can also complicate the result.

The formula output is correct, but pasted values look wrong: Copy the entire output, including all rows, and use Edit > Paste special > Values only. Check the destination dimensions before pasting. If the source had special formatting, values-only paste will not copy that formatting; apply the desired date or number format separately with Format > Number.

The date values are correct but display differently: Sorting changes the order, not the date display style. Select the result and choose Format > Number, then select a date format. If the displayed day and month appear swapped, check File > Settings and the spreadsheet’s locale before converting or pasting dates.

Frequently Asked Questions

Can I sort dates from left to right directly in Google Sheets?
Not with a standard horizontal-sort option like Excel’s. Use the TRANSPOSE and SORT formula, or transpose the data into a helper range, sort its rows, and transpose it back.

How do I sort the dates without separating the data below them?
Include the date row and every associated row in the same rectangular range. The formula sorts whole columns as records, using the first row of that range as the date key.

How do I put the newest date first?
Use FALSE as the third argument of SORT. For dates in A1:Z1, the formula is =TRANSPOSE(SORT(TRANSPOSE(A1:Z1),1,FALSE)).

Why are my dates sorting alphabetically or into the wrong order?
They may be text rather than date values, or the spreadsheet locale may interpret day and month in an unexpected order. Convert the entries to dates and check File > Settings before sorting again.

Will the formula change my original row?
No. It produces a separate sorted result. When you are satisfied, copy that output and paste values over the original if you want a permanent rearrangement.

Can I sort only part of the row?
Yes, but include the whole set of cells that should move together. Sorting only a selected portion can leave the rest of the records in their original positions, so verify the range before using the result.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.