Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>Spalten und Zeilen tauschen bei Excel2011 oder Numbers?!

Spalten und Zeilen tauschen bei Excel2011 oder Numbers?!

MacSepp28.06.1210:19
Hallo Gemeinde!

Ich habe eine Tabelle von einem Kollegen, die ich aber natürlich genau andersherum angeordnet hab. Was er in den Spalten hat, hätte ich gern in den Zeilen und umgekehrt. Jetzt hab ich sowohl Excel als auch Numbers zur Auswahl, finde aber keine Option, die die beiden Achsen inkl. Benennung und Werten vertauscht.

Das muss es doch geben, oder?!

Vielen Dank und beste Grüße!
0

Kommentare

kalli50028.06.1210:24
In Excel kopierst Du die Daten in die Zwischenablage und bei "Inhalte einfügen..." wählst Du dann die Option "Transponieren".
0
kalli50028.06.1210:35
Und in Numbers hilft dieses AppleScript (Nicht meins, aber ausprobiert)

(Apple Script Editor mit diesem Script öffnen, die Daten in die Zwischenablage, in Numbers an die Stelle klicken wo es hin soll und dann im AppleScript Editor "Ausführen" klicken)


(*
Thanks to Scott Lindsey & Ed.Stockly from applescript-users@lists.apple.com

Copy a group of cells in the clipboard.
Put the cursor where you want.
Run the script.
It will insert the transposed set of values.
Of course, it will be a 'frozen' block.
Changes in the source one will not be reflected.

Yvan KOENIG (Vallauris, FRANCE)
15 janvier 2009
*)

on run
try
set avant to the clipboard as text
on error
error "No copied values in the clipboard !"
end try
set avant to paragraphs of avant

repeat with i from 1 to count of avant
set item i of avant to my decoupe(item i of avant, tab)
end repeat

set {rName, tName, sName, dName} to my getSelection()
if rName is missing value then error "No selected cells"

set twoNames to my decoupe(rName, ":")
set {colNum1, rowNum1} to my decipher(item 1 of twoNames)
(*
if item 2 of twoNames = item 1 of twoNames then
set {colNum2, rowNum2} to {colNum1, rowNum1}
else
set {colNum2, rowNum2} to my decipher(item 2 of twoNames)
end if
*)
(* Here we know the starting point of the destination area. *)

tell application "Numbers"
activate
tell document dName to tell sheet sName to tell table tName

set rowsCible to (get row count)
set rowsNeeded to rowsCible - 1 + (count of item 1 of avant)
if rowsNeeded > rowsCible then
repeat (rowsNeeded - rowsCible) times
add row below row rowsCible
end repeat
end if -- rowsNeeded

set columnsCible to (get column count)
set columnsNeeded to columnsCible - 1 + (count of item 1 of avant)
if columnsNeeded > columnsCible then
repeat (columnsNeeded - columnsCible) times
add column after column columnsCible
end repeat
end if -- columnsNeeded

repeat with i from 1 to count of avant
repeat with j from 1 to count of item 1 of avant
set value of cell (colNum1 - 1 + i) of row (rowNum1 - 1 + j) to item j of item i of avant
end repeat
end repeat
end tell
end tell
end run

--=====

on getSelection()
local mySelectedRanges, sheetRanges, thisRange, _, myRange, myTable, mySheet, myDoc, mySelection
--tell application "Macintosh HD:Applications:iWork '09:Numbers.app"
tell application "Numbers"
activate
tell document 1
set mySelectedRanges to selection range of every table of every sheet whose it is not missing value
repeat with sheetRanges in mySelectedRanges
try
count of sheetRanges
on error
set sheetRanges to {sheetRanges}
end try
repeat with thisRange in sheetRanges
if contents of thisRange is not missing value then
try
--return thisRange --poorly formed result
thisRange as text
on error errMsg number errNum
set {_, myRange, _, myTable, _, mySheet, _, myDoc} to my decoupe(errMsg, quote)
--set mySelection to (a reference to (range rn of table tn of sheet sn))
return {myRange, myTable, mySheet, myDoc}
end try
end if -- contents…
end repeat -- thisRange
end repeat -- sheetRanges
end tell -- document 1
end tell -- application

return {missing value, missing value, missing value, missing value}
end getSelection

--=====

on decipher(n)
local letters, colNum, rowNum
set letters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if (character 2 of n) as text > "9" then
set colNum to (offset of (character 1 of n) in letters) * 64 + (offset of (character 2 of n) in letters)
set rowNum to (text 3 thru -1 of n) as integer
else
set colNum to offset of (character 1 of n) in letters
set rowNum to (text 2 thru -1 of n) as integer
end if
return {colNum, rowNum}
end decipher

--=====

on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe

--=====
--[/SCRIPT]
0
MacSepp28.06.1210:37
Wunderbar! Transponieren! Werd ich nicht mehr vergessen Vielen Dank!
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.