How to Convert Columns to Rows in Excel: Transpose or Unpivot Monthly Data

Convert columns to rows in Excel with Transpose, or unpivot month columns into rows with Power Query or TOCOL, so pivot tables and charts work.

Founder, Glow Reports. , 3 min read
  • Excel
  • Power Query
  • Data Quality
A wide row of coloured blocks tipping over and stacking into a tall column beside a small bar chart
On this page
  1. Do you need to transpose or to unpivot?
  2. How do you transpose columns to rows in Excel?
  3. How do you unpivot months into rows with Power Query?
  4. Can a formula unpivot the data without Power Query?
  5. How do you convert columns to rows in Google Sheets?
  6. How do you turn the month headers into real dates?
  7. Where does Glow Reports fit?
  8. Common questions

A sales or budget export arrives with one column per month: Jan, Feb, Mar. You want rows instead, so you can filter by month, build a pivot table or chart a trend. There are two different jobs behind "convert columns to rows". If you want to flip the table on its side, use Transpose. If you want one row per product and month, you need to unpivot, with Power Query or a TOCOL formula. Below: how to tell which one you need, the steps for each, the Google Sheets version, and how to turn the month labels into real dates.

Do you need to transpose or to unpivot?

Transpose swaps rows and columns: the month headers become row labels and the products become headers. Unpivot stacks the month columns into two new columns, one for the month and one for the value, so each product and month gets its own row.

Take this export, with the product in column A and one column per month:

ProductJanFebMar
Basic120135150
Plus8095
Pro151822

Transposed, it still has one cell per figure, only rotated. Months run down column A and the three products sit across the top. That helps when a chart or a layout expects the other orientation.

Unpivoted, it becomes a long table with three columns, Product, Month and Units, and 8 rows. The empty Feb cell for Plus drops out. This is the shape a pivot table, SUMIFS and most charts expect. A pivot table can only group by month if the month sits in one column, which is why a pivot table by month starts from data in rows.

How do you transpose columns to rows in Excel?

Copy the range, right-click the cell where the result should start, and choose Paste SpecialTranspose. Excel pastes a rotated copy. For a copy that updates when the source changes, type in the first cell instead.

Microsoft's steps add three details Microsoft Support:

  • Copy with Ctrl+C. Cut with Ctrl+X does not work.
  • Paste into empty space, since the pasted block overwrites anything already there.
  • If the data is an Excel table, Transpose is greyed out. Convert the table to a range first, or use the TRANSPOSE function.

In Microsoft 365, spills the result on its own. In older versions it is a legacy array formula: select the output range first, type the formula and confirm with Ctrl+Shift+Enter Microsoft Support.

How do you unpivot months into rows with Power Query?

Load the range into Power Query, select the columns that describe each row (here Product), and choose TransformUnpivot Other Columns. Power Query stacks every other column into an Attribute column and a Value column. Rename them Month and Units, then load the result.

The steps, from a range or a table:

  1. Select a cell in the data and choose DataFrom Table/Range.
  2. In the Power Query Editor, select the Product column. Hold Ctrl to add any other descriptive columns, such as Region or SKU.
  3. Choose TransformUnpivot Other Columns.
  4. Double-click the Attribute and Value headers to rename them.
  5. Choose HomeClose & Load.

Pick Unpivot Other Columns over Unpivot Only Selected Columns. Microsoft notes that it unpivots the columns you did not select, so "new columns added during a refresh operation are also unpivoted" Microsoft Support. When next month's export arrives with an Apr column, you replace the source and click DataRefresh All. The step behind the button is , which keeps the listed columns and turns the others into attribute-value pairs Microsoft Learn.

Power Query skips empty cells when it unpivots, so the blank Feb value for Plus does not become a row. If a missing month should count as 0, replace nulls with 0 before the unpivot step. The same editor can stack several monthly files first, as shown in how to merge Excel and CSV files with Power Query.

Can a formula unpivot the data without Power Query?

Yes, in Microsoft 365. TOCOL turns a grid into one column, and HSTACK puts three such columns side by side. One formula builds the Product, Month and Units columns and grows when the source grows.

Product, month and units in rows, 8 rows
=HSTACK(TOCOL(IF(B2:D4<>"",A2:A4,NA()),2),TOCOL(IF(B2:D4<>"",B1:D1,NA()),2),TOCOL(IF(B2:D4<>"",B2:D4,NA()),2))

How it works:

  • repeats each product name across its row of months, and puts an error where the value is empty.
  • The second IF does the same with the month headers down each column.
  • TOCOL reads each grid row by row into one column. Its second argument, 2, tells it to ignore errors, so the empty cells drop out Microsoft Support.
  • HSTACK joins the three columns into one table Microsoft Support.

The result lists Basic for Jan, Feb and Mar, then Plus for Jan and Mar, then Pro. Its Units column adds up to 635, the same as the original grid. Check that total every time. A formula that drops a row leaves the sum short.

The formula suits a sheet you rebuild by hand. For an export that comes back every month with more columns, Power Query is easier to maintain, because you never touch the ranges.

How do you convert columns to rows in Google Sheets?

Use to rotate the table Google Docs Editors Help. To unpivot, Google Sheets has TOCOL with the same arguments as Excel, including 2 to ignore errors Google Docs Editors Help, and HSTACK.

Paste the formula from the previous section and wrap it in ARRAYFORMULA so the IF tests work on whole ranges: . Sheets has no Power Query, so the formula is the way to keep the long table in step with the source.

How do you turn the month headers into real dates?

Give each month a full date before you report on it. A header such as "Jan" is text, and text sorts alphabetically, so Apr lands before Jan in a pivot table and a chart. Add a Date column next to Month and convert there.

If the headers read "Jan 2026", returns 1 January 2026 when B2 holds the label. DATEVALUE reads month names in the language of your regional settings, so an English label fails on a French system. In Power Query, select the Month column and choose TransformData TypeUsing Locale to read it with the language of the export. A header with no year needs the year added first, from the file name or the report period.

Once the date is real, format it as to show "Jan 2026" again while it sorts as a date. If the converted cells stay on the left and refuse to sum, they are still text, a case covered in how to convert text to date in Excel.

Where does Glow Reports fit?

The steps above reshape one export. The work repeats when every report starts from a wide export, the months shift each time, and a budget file and an actuals file come in two different shapes before they can be compared.

With Glow Reports, you upload one or several CSV or Excel files and ask for the report in plain language, such as units by product and month. The AI writes the SQL, builds the charts and drafts the text. The SQL sits under each figure, so you can see how the month columns were read and edit the query if a column was left out. Reports export to PDF and stay in the workspace. The free plan gives 300 credits once, and a report costs 100 credits. To compare a plan with actuals once both are in rows, see budget vs actual in Excel.

Common questions

How do I convert rows to columns in Excel?

Use the same tools in the other direction. Paste Special with Transpose, or , turns rows into columns. To turn a long table back into one column per month, use a pivot table with the month in Columns, or TransformPivot Column in Power Query.

Why is Transpose greyed out in Paste Special?

The data is an Excel table, or you cut it when you should have copied it. Convert the table to a range with Table DesignConvert to Range, or use the TRANSPOSE function, and copy with Ctrl+C.

Why does TRANSPOSE return #SPILL!?

The cells where the result should spill are not empty. Clear the range below and to the right of the formula, or move the formula to empty space.

Does unpivot work with several descriptive columns?

Yes. In Power Query, select every column that describes the row, such as Region, Product and SKU, before you choose Unpivot Other Columns. Only the remaining columns are stacked.

El Mehdi Benane
Founder, Glow Reports

I am a product engineer and the founder of Glow Reports. I spent more than 6 years building products in tech, data and cybersecurity, for large groups, startups and SMEs. In most organizations I saw data treated as a technical topic, when it drives business decisions. I built the reporting tool I was looking for, so the people who run small and mid-sized organizations can read their own numbers without a data team.

Upload your CSV or Excel exports to Glow Reports and ask for the report by month, with the SQL behind each figure so you can check how each column was read.

Keep reading