By David H. Ringstrom, CPA
From time to time, you may encounter data that's presented in rows, when you actually need it to be in columns instead. Or you may wish to flip data in columns into a row format. Many users don't realize that Excel offers an easy way to accomplish this task with just a couple of mouse clicks. You can even create a keyboard shortcut in Excel 2007 and later. I'll also discuss a couple of frustrating nuances you may encounter when transposing data.
Let's assume that you have a list of car buyers and their vehicle information presented on two rows as we see in Figure 1. We'd like to transform this data into a columnar list, as shown in Figure 1, so that we can use the information to generate letters via Mail Merge in Microsoft Word.
Figure 1: Data presented in rows can be transposed to columns.
To do so, select cells A1 through C3, and press Ctrl-C to copy. Next, right-click on cell E3 and choose Paste Special. Click the Transpose checkbox, and then click OK, as shown in Figure 2.
Figure 2: You can easily transpose data from columns to rows, or vice versa.
Transforming data back to rows is just as simple. Select the data in cells E3 through F6, press Ctrl-C to copy, and then right-click on the cell of your choice and use Paste Special, Transpose.
Transposing data in Excel 2010 and later is even easier thanks to a new icon that appears when you right-click on a cell, as shown in Figure 3. The fourth icon in the Paste Options section allows you to skip the Paste Special dialog box. As an added benefit, if you hover over this icon for a moment, Excel shows you a preview of how the data will look if you transpose it.
Figure 3: Excel 2010 and later offers a Transpose shortcut.
If you spend a lot of time transposing data, you can create a keyboard shortcut in Excel 2007 and later. To do so, carry out these steps, as also illustrated in Figure 4:
- Right-click on the Home tab and choose Customize Quick Access Toolbar.
- Select All Commands from the Choose Commands From list.
- Scroll down and click once on Paste and Transpose, then click Add, or simply double-click on Paste and Transpose.
- Click OK to close the Excel Options dialog box.
Figure 4: You can add a Transpose icon to your Quick Access Toolbar in Excel 2007 and later.
Your new Transpose icon will have a shortcut key predicated on the order in which the command appears on your Quick Access Toolbar. As shown in Figure 5, you can now press Alt-4 to transpose data. Keep in mind that this option is only enabled when you have data on the clipboard.
Figure 5: Quick Access Toolbar icons can be accessed via keyboard shortcuts.
There are two quirks to keep in mind with regard to transposing data:
1. You cannot transpose data into the range of cells from which you've copied. If you attempt to do so, Excel will present the cryptic prompt shown in Figure 6. Simply consider the marquee border around the cells you've copied to be an electric fence that you shouldn't touch. Once you've transposed the data, you're then free to cut and paste it into a new position.
Figure 6: Excel doesn't allow data to be transposed into the cells from which you've copied data.
2. In many cases, the formulas will adjust automatically, but in other cases you may be presented with a series of #REF! Errors. In such cases, use the Paste Special dialog box and choose the Values option along with the Transpose checkbox, as shown in Figure 7.
Figure 7: Choose Values along with Transpose if transposed formulas result in #REF! errors.
Read more articles by David Ringstrom.
About the author:
David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at email@example.com or follow him on Twitter . David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link .