Unpivot data from wide to tall format
=ARRAYFORMULA(SPLIT(TOCOL(dimension&"🔢"&column_headers&"🔢"&data_range, 0), "🔢"))Source: Ben Collins — submitted by Keshia Rose
This function unpivots data from a wide format to a tall format, making it easier to analyze and work with in databases, visualizations, or other applications. It takes a single column of data (dimension), column headers, and a range of data values, and returns a table with the dimension, column headers, and corresponding data values in separate rows. To use this function, define "dimension" as the column containing the dimension data (such as names or categories), "column_headers" as the column containing the pivoted headers (e.g., dates or subcategories), and "data_range" as the matrix containing the data to be unpivoted. Place this function in the first cell where you want the new unpivoted data to appear, and it will automatically reformat the specified range into an expanded format. This function produces an array of values outside of the cell containing this formula.
Use the inputs below to create UNPIVOT as a reusable custom function in Google Sheets.
Learn how to add custom functions to Google SheetsUNPIVOT
Unpivot data from wide to tall format
=ARRAYFORMULA(SPLIT(TOCOL(dimension&"🔢"&column_headers&"🔢"&data_range, 0), "🔢"))
dimension
column_headers
data_range
The single column/dimension of data you want to unpivot. These values will be repeated.
C21:C24
The column headers to be unpivoted into rows.
D20:G20
The range of data values to be unpivoted.
D21:G24
Named functions enable the creation of custom, reusable formulas that mimic built-in functions, streamlining calculations and data manipulations. These functions simplify complex formulas, making spreadsheets more readable and less prone to errors. By encapsulating intricate logic within a single function call, they enhance consistency across your data. Utilizing named functions reduces the need to write lengthy formulas repeatedly, thereby improving workflow efficiency and productivity in data analysis and management.
Download and import — fastest way to add the function but does not include argument descriptions and examples
Follow these simple steps to download and import a function into your spreadsheet. This method is the quickest and easiest way to add the named function to your Google Sheets document, but will not include the argument description and examples.
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.
Copy and paste — copy and paste each property one at a time
Follow these simple steps to integrate a custom named function into your spreadsheet:
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.