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
You can make a difference in the Apple Support Community!
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
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
CD,
There is a TRANSPOSE function, but it's not too useful in my experience, since you have to use INDEX to read the result out of internal memory. Below are two examples, the first using TRANSPOSE and INDEX and the second using only INDEX, but this time reading the input table directly rather than via the transpose function. Note that skipping the transpose function requires that you reverse the Row and Column arguments.
In case the graphic is difficult to read, the first expression is:
=INDEX(TRANSPOSE(INDIRECT("Input")), ROW(), COLUMN())
and the second expression is:
=INDEX(Input, COLUMN(), ROW()).
Jerry
"being (apparently) the only living person on the planet with my particular combination of just four common English syllables"
That's nothing; you should try carrying around the name of a suburb of London, and one that has the unenviable reputation of being the most racist... 😉
carrying around the name of a suburb of London, and one that has the unenviable reputation of being the most racist... 😉
Sounds like an unhappy place these days. But a fine old name. Tell 'em it's Eltham as in John of Eltham, or the Eltham ordinances, not that Eltham.
SG
Thanks SGIII
Can't believe how well that works.
Took me a while to work out you select origin text before services, then it works like a dream, so much so I created my first screencast - without sound I'm afraid 😟 http://youtu.be/A9spe0-Z1Wg
Tom
Hi Tom,
Nice to see the demo of what I call the 'Copy Transpose' script in action! You may have noticed you can share it as a "self-installing" service by choosing the .workflow package in Finder, right-clicking, and and choosing Compress.... The recipient just has to double-click the .zip package and it will move itself to the Library > Services folder so that it appears in the Services menu. (The recipient may have to click 'download anyway' in System Preferences > Privacy & Security).
SG
Awesome 🙂 I wish I knew others who share this problem so I could send this to them, but assume the Numbers "community" would be delighted to be able to simply download such a service. I assume this forum doesn't permit hosting such files, but I would be happy to do so unless anyone can suggest a better alternative.
I think I forgot to thank you for sharing this, so thanks very much!
Tom
You can grab a copy of a self-installing 'Copy Transpose' Automator Service here (Dropbox download). Feel free to share as you see fit.
SG
That's perfect, thanks SGIII
Hi SGIII,
Please I need your help, I have tried to run the script but I get the following message:
"Syntax Error
Expected end of line but found class name."
And "sheet" at the end of the second line of the script is highlighted. Could you help me figure out what is going on?
Thanks in advance,
Diego
Hi Diego,
Make sure you are running Numbers 3 without Numbers 2 open at the same time.
If you still get an error then try copying and pasting the script into AppleScript Editor.
Or you could try using the service you can download via the link upthread.
SG
One other thought. If you're using Numbers 2 and not Numbers 3, then the script should work if you replace this line:
tellapplication "Numbers" totellfrontdocumenttotellactive sheet
With this:
tell application "Numbers" to tell front document to tell (first sheet whose every table's selection range's class contains range)
SG
Hi SGIII,
I think I'm missing something on this. I'm using Numbers 3.2 but everytime I select a range and then select the workflow I get an error message saying:
"Select a range first and then try again"
Is there something special I need to do when selecting a range ?
Hope you can help
Thanks in advance
Natalie
Ok I solved it, well it's working now anyway !!
For some bizarre reason after I had quit numbers and re-opened the same file it is all now working, so thank you again SGIII your workflow has saved me from lots of tedious data entry.
Thanks
Hi Natalie,
Great to hear it's working now! One thing that's easy to forget is that only one version of Numbers should be open at the time you run the script. Also some utility-type applications that jazz up your clipboard (CopyClip, Command-C, CommandClip, and probably dozens or hundreds of others) can get in the way.
SG
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
Glad you were able to get it to work in Numbers 2.
SG
transpose columns and rows in numbers