homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Other Geeky Stuff   » Ask a Geek!   » Excel help

 - UBBFriend: Email this page to someone!    
Author Topic: Excel help
littlefish
BlabberMouth, a Blabber Odyssey
Member # 966

Member Rated:
4
Icon 1 posted September 29, 2004 08:43      Profile for littlefish   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Okay, I'm trying to re-arrange my data to make it more friendly to my eyes, and also allow myself to do maths on it.

Basically I have a large excel spreadsheet and I want to rotate it, so that the data is arranged in columns rather than rows. To put it another way I want to change:
a b c
d e f
g h i
into
a d g
b e h
c f i.

Is there an easy way to do this? The file is a .csv so it doesn't have to use excel. I'm also putting it into some graphing software called Origin, and doing some maths on it there (if I ca figure out fourier transforms!)

Posts: 2421 | From: That London | Registered: Nov 2001  |  IP: Logged
Allan
SuperFan!
Member # 1717

Member Rated:
5
Icon 1 posted September 29, 2004 11:21      Profile for Allan     Send New Private Message       Edit/Delete Post   Reply With Quote 
Try the following macro

Sub rotate()

Dim i As Integer
Dim j As Integer
Dim x As Integer
Dim destSheet As String

'save the name of the target sheet
destSheet = ActiveSheet.Name

'copy the target sheet to last sheet in workbook, and give it a name
Sheets(ActiveSheet.Name).Copy after:=Workbooks(ActiveWorkbook.Name).Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "Playtime!!"

'assign a value for the number of columns and rows, as per the example use 3.
x = 3


For i = 1 To x

For j = 1 To x

Sheets(destSheet).Cells(j, i) = Sheets("Playtime!!").Cells(i, j)

Next j

Next i

'delete the copy 'playtime!!'
Sheets("playtime!!").Delete

'select the original sheet
Sheets(destSheet).Select

'set the focus to cell a1
ActiveSheet.Cells(1, 1).Select


End Sub

Posts: 1280 | From: Edinburgh, Scotland / Frankfurt, Germany | Registered: Oct 2002  |  IP: Logged
littlefish
BlabberMouth, a Blabber Odyssey
Member # 966

Member Rated:
4
Icon 1 posted September 29, 2004 15:44      Profile for littlefish   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Macros :shudder:

Cheers Allan, I'll give it a go on Monday. I'm off on a jaunt down south tomorrow for my cousins wedding.

Posts: 2421 | From: That London | Registered: Nov 2001  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted September 29, 2004 22:15      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
#!/usr/bin/perl -w
use strict;

#go to sleep
#write some code tomorrow

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
nekomatic
SuperFan!
Member # 376

Member Rated:
5
Icon 6 posted October 12, 2004 03:53      Profile for nekomatic     Send New Private Message       Edit/Delete Post   Reply With Quote 
(ducks in)

Hi all, no I haven't been round here much lately - hope you're all well and having fun!

(reads other threads) yeah, it looks like you are, mostly [Smile]

Yup, there's an easy way: Paste Special - Transpose.

(ducks out)

Posts: 822 | From: Manchester, UK | Registered: Mar 2000  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam