Search code examples
excelms-officevba

Excel rotate (NOT transpose) a table 90 degrees clockwise


I have a table in Excel. How can I rotate (NOT transpose) a table 90 degrees clockwise?

Example

cell1  |  cell2  | cell3
cell4  |  cell5  | cell6

Expected

cell3  |  cell6
cell2  |  cell5
cell1  |  cell4

P/S: If I use transpose option when paste, I will have unexpected result

cell1  |  cell4
cell2  |  cell5
cell3  |  cell6

Thanks


Solution

  • Assuming you want to do this manually, and that it doesn't need to be done via functions:

    1. First transpose your range using the regular copy transpose paste function
    2. Next, create an artificial sorting key (simply number is 1 to n) infront of the first column and sort in a descending order
    3. Delete the sorting column you created in front of the first row