You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- Transposing rows

Advertisement

Hello Aidan,

I have some family data that i need to re-arrange. Data is as follows in three columns. The data per family is separated by blank rows. Each set/family can have different numbers of rows, depending on members eg

ColA Col B Col C

Ref: Name Amount (header)

001 Mr. X 2000

001/1 Ms. X 2000

001/2 Mrs X 1000

002 Mr. Y 500

003 Mr. Z 5000

003/1 Mrs Z 1500

etc

I want to transpose this data in rows across columns

eg

A B C D E F G

002 Mr. Y 500

003 Mr. Z 5000 Blank 003/1 Mrs Z 15000

Kindly help as i couldnt find a suitable macro so far.

Thank you :)

Yana

This macro will do what you want - it stores the data on the same workbook, starting in column F

Sub sorter()

Dim x As Long

x = Cells.SpecialCells(xlCellTypeLastCell).Row

Dim w As Long

Dim y As Long

Dim z As Long

w = 1

For z = 2 To x

If Cells(z, 1).Value = "" Then

w = w + 1

y = 5 'and no further action this time

Else

y = y + 1 'sets the output location

Cells(w, y).Value = Cells(z, 1).Value

y = y + 1

Cells(w, y).Value = Cells(z, 2).Value

y = y + 1

Cells(w, y).Value = Cells(z, 3).Value

y = y + 1

End If

Next

End Sub

- Add to this Answer
- Ask a Question

Rating(1-10) | Knowledgeability = 10 | Clarity of Response = 10 | Politeness = 10 |

Comment | Thank you Aidan! Worked like a magic wand! Thanks alot! |

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!

My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.**Education/Credentials**

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!