How to interchange a column and row in a table (Transpose) in iWork Numbers?

19,895

Solution 1

I wrote a simple AppleScript that does it.

tell application "Numbers"
    activate
    tell the front document
        tell the first sheet
            set original_range to selection range of first table

            set orignal_table to first table
            set number_of_columns to column count of orignal_table
            set number_of_rows to row count of orignal_table
            set trasposed_table to make new table with properties {row count:number_of_columns, column count:number_of_rows}

            repeat with i from 1 to number_of_columns
                repeat with j from 1 to number_of_rows
                    tell orignal_table
                        set original_value to the value of cell i of row j
                    end tell
                    tell trasposed_table
                        set the value of cell j of row i to original_value
                    end tell
                end repeat
            end repeat

        end tell
    end tell
end tell

Here you can find more details about it.

Solution 2

Those using the latest version of Numbers can use the "Transpose Rows and Columns" option under the "Table" menu, as seen in this answer over on StackExchange. Image below also shamelessly 'borrowed' from that answer, for easy reference.

Share:
19,895

Related videos on Youtube

Saneef
Author by

Saneef

Updated on September 17, 2022

Comments

  • Saneef
    Saneef almost 2 years

    I want to transpose a table (interchange rows to columns and vice versa). How to do that in iWork Numbers.

  • teeto
    teeto over 11 years
    It's worth mentioning this formula takes the cells' value meaning that if you have formulas in the cells you are transposing, only their output will be transposed. The formulas will not be.