Change HORIZONTAL Data to VERTICAL
(NO Transpose Function needed)
Efficiency is a key objective here at XelPlus, but sometimes even the best of us miss the mark.
In a previous post, we discussed three different ways to transpose data in Excel.
The third method discussed was more of a hack to transpose the data using techniques not officially advertised in Excel. The article for these methods can be viewed here:
A viewer commented that in method #3, the hack, there are many manual and inefficient steps involved in the solution.
Let’s see how this hack can be turned into a better hack!
Using the Original Replacement Hack
Our sample data is arranged in rows, but we need it to be arranged in columns like a traditional table.
The idea was to write the formulas as traditional cell-to-cell links (i.e. =B2) but use a bit of fixed text in place of the equals sign, such as “lg” – or your initials. (After we fill it down we would replace the “lg” with an equals sign to put everything back the way Excel expects it for proper cell-to-cell links.)
After we create a pattern for Excel to follow, we fill the pattern down.
The number sequences would continue when filling in a left-to-right direction, but it does not work when filling in a downward direction.
This is because when transposing from vertical to horizontal, we need the numbers in the cell references to change, and Excel is smart enough to figure that out.
When filling in a downward direction, we need the letters that reference the columns to change. Excel cannot distinguish our placeholder text (“lg”) from the column letter reference so it just repeats the original set of references.
Enter the Better Hack
When researching this problem, I came across a method by 25-year Excel MVP Bob Ulmas.
This hack requires we change one of the Excel program options.
Select File (tab) to enter the Backstage. Select Options – Formulas – Working with formulas and place a check in the option labeled R1C1 reference style.
Take a look at the column headings. Everything is using numbers.
Select an empty cell (such as D8) to point to cell B2. Enter the following formula.
Notice that the result is the same as it was when we entered =B2. This notation is telling Excel to point to the cell located in Row 2 and Column 2.
Another way of creating the cell-to-cell reference is to type an equals sign and click cell B2 with the mouse.
This will produce the following formula.
Think of this a relative reference; we’re telling Excel to travel back 6 rows and back 2 columns in the spreadsheet (when entered in cell D8).
Implementing the “LG” Trick
Now we’ll utilize the trick where we enter some placeholder text in lieu of the equals sign.
Below the APP title, enter the following formula.
Below the SALES title, enter the following formula.
Select both formula cells and pull the Fill Series handle down the columns.
Excel updates the column reference numbers in sequence.
We will now select our newly created placeholder data cells and perform a Find/Replace operation; searching for all instances of “lg” and replacing them with equals signs.
Take a look at our updated column list.
Set Excel Options Back to Normal
Unless you have more lists to transpose, it’s a good idea to reset the Excel option in charge of notation style. Select File (tab) to enter the Backstage. Select Options – Formulas – Working with formulas and uncheck the R1C1 reference style option.
Notice that our cell-to-cell reference formulas are displayed as traditional absolute references.
Hiding the Zeroes
If you created formulas to accommodate longer lists, you are most likely presented with several zeroes at the bottom of your transposed data.
You can hide these zeroes many ways with creative formulas, but a simple technique is through a custom number format.
Select the output of the transpose operation, right-click on the highlighted area and select Format Cells…
In the Number Formatting dialog box, select the Custom category on the right and enter a custom number format that would hide the zeroes.
Because we are using large numbers, we wish to display commas every third place position and we do not wish to display any fractional values. Enter the following custom number format.
Now the zeroes will be hidden, but additions to the original horizontal list will appear in the transposed vertical list.
Feel free to Download the Workbook HERE.
Learn when you like, where you like.
Check out my bestselling Excel Courses
Learn anytime that fits your schedule.
Download files. Practice. Apply.