Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rotate Excel Data

Status
Not open for further replies.

PMCap

Mechanical
Jan 18, 2005
86
Does anyone know the process for rotating data on an EXCEL data sheet. I do not want to transpose the data. I want to just physically rotate the data.

Example left to right columns are labeled A B C D Rows within the columns are labeled 1, 2, 3, 4 as follows

A B C

1 3 4 5
2 6 8 2
3 2 9 1

I would like to rate 90 degrees clockwise to the following:

3 2 1

A 2 6 3
B 9 8 4
C 1 2 5

Thank you
 
Replies continue below

Recommended for you

You could possibly do a reverse order sort on the rows, then transpose.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
Here's a UDF that will do it:

Code:
Function RotateRange(RRange As Variant) As Variant
Dim NumRows As Long, NumCols As Long, i As Long, j As Long, RotnA() As Variant

RRange = RRange.Value2
NumRows = UBound(RRange)
NumCols = UBound(RRange, 2)
ReDim RotnA(1 To NumCols, 1 To NumRows)
For i = 1 To NumRows
For j = 1 To NumCols
RotnA(j, i) = RRange(NumRows + 1 - i, j)
Next j
Next i
RotateRange = RotnA
End Function

Enter as an array function and it will return a rotated version of RRange.

Please ask if anything isn't clear.


Doug Jenkins
Interactive Design Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor