Skip to main content

Columns To Rows

Columns to Rows allows the data conversion from wide format to long format. In other words, it allows the stacking of multiple column values into a single column.

Quickstart

Let us look at the following sample data:

Country200020052010
China1,242,612,3001,307,593,0001,339,724,852
India1,040,000,0001,103,371,0001,182,105,564
United States281,421,923295,520,000309,349,689

The same data can also be represented in the following format:

CountryYearPopulation
China20001,242,612,300
China20051,307,593,000
China20101,339,724,852
India20001,040,000,000
India20051,103,371,000
India20101,182,105,564
United States2000281,421,923
United States2005295,520,000
United States2010309,349,689

The first format of representation of data is called the wide format since the years in the data are distributed across the columns. The second format is called the long format because the years in the data are distributed across the rows. where each year of data is in a separate observation. Data in the long format is easier to use for some types of analysis.

If the data is in long format:

  1. You can rank values within each category and see them in relation to one another.
  2. Filter easily across different categories.
  3. Create summary more easily by grouping or crosstabing the data.

The Columns to Rows task can convert wide format to long format by completing the following steps:

  1. Go to Transform > Reshape, Group & Aggregate.
  2. Click on the Columns To Rows option.
  3. Select all the columns that you want to convert from wide format to long format.
  4. Name the Label and Value columns appropriately.
  5. Click APPLY.

Supported Options

The following options are supported:

  1. Column Selection: You can select the columns that you want to convert to long format. You can tweak the labels attached to each column. Only the columns of matching types can be stacked and the resulting value column produced also has the same type.
  2. Label: The name of the column where all the labels are stacked.
  3. Value: The name of the column where all the column values are stacked.