# 30 Excel Functions in 30 Days: 13 – TRANSPOSE

Yesterday, in the 30XL30D challenge, we counted columns with the COLUMNS function, and now it’s time for something a bit more demanding.
For day 13 in the challenge, we’ll examine the TRANSPOSE function. With this function, you can flip things around, changing vertical ranges to horizontal ones, or vice versa. Is that something you need to do? Could you use Paste Special instead? Could other functions do the same thing?
NOTE: You can have all of the 30 Functions content in an easy-to-use single reference file — the 30 Excel Functions in 30 Days eBook Kit (\$10).
So, let’s take a look at the TRANSPOSE information and examples, and if you have other tips or examples, please share them in the comments.

### Function 13: TRANSPOSE

The TRANSPOSE function returns a horizontal range of cells as a vertical range, or vice versa.

### How Could You Use TRANSPOSE?

The TRANSPOSE function can change the orientation of data, or be used with other functions:

• change horizontal data to vertical
• show total salary over best consecutive years

To change data orientation, without links,

• use Paste Special > Transpose.

### TRANSPOSE Syntax

The TRANSPOSE function has the following syntax:

• TRANSPOSE(array)
• array  is an array or a range of cells to be transposed

### TRANSPOSE Traps

• TRANSPOSE must be entered as an array formula, by pressing Ctrl+Shift+Enter.
• The TRANSPOSE destination range must have the same number of rows and columns, respectively, as the array has columns and rows.

### Example 1: Change Horizontal Data to Vertical

If data is arranged horizontally in a worksheet, you can use the TRANSPOSE function to list the data vertically, in a different location. For example, in a summary sheet, or dashboard, a vertical layout might be best. With the TRANSPOSE function, you could link to your original horizontal data, without changing its layout.
To transpose a 2 row x 4 column horizontal range to a 4 row x 2 column vertical range:

1. Select the 8 cells where you want to display the data vertically  — cells B4:C7 in this example.
2. Type this formula, then enter it as an array formula, by pressing Ctrl+Shift+Enter.

=TRANSPOSE(B1:E2)
Curly brackets will be automatically added at the start and end of the formula, to show that it is array entered.

Instead of using TRANSPOSE, you could use another formula to display the data, such as this INDEX formula. It does not require array entry, and you don’t have to select all the destination cells when creating the formula.
=INDEX(\$B\$2:\$E\$2,,ROW()-ROW(C\$4)+1)

### Example 2: Change Orientation Without Links

If you just want to change the orientation of your data, without keeping a link to the original data, you can use Paste Special:

1. Select the original data and copy it
2. Select the top left cell of the destination range
3. On the Ribbon’s Home tab, click the Paste drop down arrow
4. Click Transpose
5. (optional) Delete the original data.

### Example 3: Total Salary For Best Consecutive Years

The TRANSPOSE function can be used with other functions, as in this eye-popping formula. It was posted by Harlan Grove, in the Excel newsgroups, in a discussion on calculating the total salary for best 5 consecutive years.
=MAX(MMULT(A8:J8,–(ABS(TRANSPOSE(COLUMN(A8:J8))
-COLUMN(OFFSET(A8:J8,0,0,1,COLUMNS(A8:J8)-Number+1))
-(Number-1)/2)<Number/2)))

As you can see by the curly brackets in the formula bar, this formula is array entered. Cell A5 is named Number, and I’ve entered 4, for the number of years this example.
The formula tests the ranges to see if there are enough consecutive COLUMNS. The results of those test (1 or 0) are multiplied by the cell values, to get the total salaries.
To check the results, in the rows below the salaries, the total salaries for each starting cell are shown, with the maximum value highlighted in yellow. This is a long way to accomplish what the previous formula did in one cell!