transpose columns and rows in numbers

I need to transpose columns and rows in Numbers and I do not want to write script to do it. Is there an easier way?

MacBook Pro, iOS 6.1.4, iWork - Numbers

Posted on Jul 29, 2013 11:10 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 15, 2017 11:20 AM

Just select the table you want to transpose and click on the menu bar item: "Table > Transpose Rows and Columns"


User uploaded file

97 replies

Jun 23, 2014 4:36 PM in response to SGIII

Your fix for getting it to work in Numbers 2 didn't quite work. Here's the version that worked in Numbers 2:


--Transpose - select range, run, paste transposed values where wanted

try

tell application "Numbers" to tell front document to tell (first sheet whose every table's selection range's class contains range)

set selected_table to first table whose class of selection range is range

tell selected_table

set first_col to the address of the first column of the selection range

set last_col to address of last column of the selection range

set first_row to address of first row of the selection range

set last_row to address of last row of the selection range

set str to ""

repeat with i from first_col to last_col

repeat with j from first_row to last_row

set str to str & (value of cell j of column i of selected_table) & tab

end repeat

set str to str & return -- add line return after row

end repeat

end tell

end tell

set the clipboard to str

on error

display dialog "Select a range first and then try again"

end try

--end script


It didn't seem to like assigning the variable my_selection to be the "selection range." Maybe it has to be declared in some way. I just dispensed with the assignment and it worked. Thanks, this will save some time in creating a mailing list using Numbers.


"She who knows not and knows not that she knows not is a fool, spurn her. She who knows not and knows that she knows not is a child, teach her. She who knows and knows not that she knows is asleep, wake her. She who knows and knows that she knows is a fanatic, kill her." -- ancient proverb

Sep 8, 2014 3:25 PM in response to SGIII

Oh, and SG, just the values from a given cell would be fine. It doesn't need to be a formula. The output from the formula is what I'm after.


Basically, my problem is that when I tell a cell the address of another, on a separate sheet, then drag down to fill a column, the address fills in as a column, rather than as a row. I need it to transpose the addresses so that the row addresses fill in on the column. I hope this makes sense...

Sep 8, 2014 6:26 PM in response to andy563

You're hiding rows 2-5 of the table! That makes it very hard to see what is going on.

Also, from your screenshot I can only see nine values in row 7 of the last table (the data input table), yet you have more than 9 values in column H of the first table. When the formula "runs out" of values in row 7 it complains you are outside the valid range.

SG

Sep 8, 2014 6:39 PM in response to SGIII

A couple things:


First, I figured it out! My problem was that I was not making the target match the original (i.e., to make this formula work, if the data input table is 18 columns wide, the dataframe has to be 18 rows long).


Second, in the picture above, I had entered in the first set of values manually (rows 2–19) and was trying out the formula on a new set (Intermedium), which started down low enough that I had to scroll down a bit to show it. The first two pictures are of the same table, just scrolled differently.


What I did to actually make this work, just to move the values that I've already collected into the dataframe, was create a temporary table on the same sheet with a matching number of rows as there are columns in the original. However, this workaround doesn't solve my issue with wanting to create a master sheet that I can use to collect data later. I'm still unable to enter a particular formula into a cell, then drag that formula down to apply to multiple rows in a column, and have those formulae refer back to a row's worth of columns in a different table. Any thoughts?


Thanks again! This will at least get me through the next few days!

Sep 9, 2014 9:41 AM in response to SGIII

I mean that, in order to get the formula to work, I have to create a temporary table of the inverted proportions (e.g., 15x1) of the original input (e.g., 1x15) that I can copy and paste the values from into the master list (i.e., the data frame), in order to export in a format that is readable by the statistics package, R. I think I may have figured out an additional workaround to get this to work. I'll try and create a new sheet and fill it with the temporary tables (i.e., the 15x1 I mentioned above), then tell the master dataframe to go look for them there, instead of in the input table. I'll let you know if it works.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

transpose columns and rows in numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.