Solved

How to  Transpose data in Excel through formula or code?

Posted on 2014-10-09
13
259 Views
Last Modified: 2014-10-09
I have my data in the following format in one column:

AMERICAS\A.GIRARD
Alejandro
Girard
No

AMERICAS\A.M.LAWRENCE
Alex
Lawrence
Yes

AMERICAS\A.MATVIENK
Alexander
Matvienk
No

AMERICAS\AARON.FUHRR
Aaron
Fuhrr
No

Please note that there is a gap of one row between each set of Data of 4 lines.
I need this data to be organized in the following manner, either on same sheet or the new sheet does not matter:

AMERICAS\A.GIRARD       Alejandro       Girard       No
AMERICAS\A.M.LAWRENCE       Alex       Lawrence       Yes
AMERICAS\A.MATVIENK      Alexander      Matvienko      No
AMERICAS\AARON.FUHRR       Aaron       Fuhrr       No

Please help.

Regards

Imran
0
Comment
Question by:Fridaybird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40370425
Assuming the data starts in Sheet1, and you are putting the new table starting in cell A1 of another sheet:

=OFFSET(Sheet1!$A$1,COLUMN(A1)-1 + (ROW(A1)-1)*5,0)

Open in new window

0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40370433
A bit more useful - assuming the data starts in Sheet1$A$1, and you are putting the new table starting in cell $a$1 of any sheet:

=OFFSET(Sheet1!$A$1,(COLUMN(A1)-COLUMN($A$1)) + (ROW(A1)-ROW($A$1))*5,0)

Change Sheet1!$A$1 to the correct location of the original data, and change the other two $A$1 to be the starting location of the new column. Both of them need to have the two dollar signs.

Copy this across three columns and down three rows for the full effect.
0
 

Author Comment

by:Fridaybird
ID: 40370443
did not work, it return some 'No' and '0's' in the same column. can you please review?
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40370444
Please see the attached spreadsheet.
Transpose.xlsx
0
 
LVL 1

Expert Comment

by:Chris Handley
ID: 40370470
not checked the other attachment, but find my attempt attached, just copy your data in a drag the cells in Sheet2 down.
0
 
LVL 1

Expert Comment

by:Chris Handley
ID: 40370475
helps if I press upload!
Book1.xlsx
0
 

Author Comment

by:Fridaybird
ID: 40370482
Apparently it works but, after few rows it wrecks order of the data, not sure if something wrong in the formation of my data or code stops working. can you please take look on the attached spreadsheet?

Many Thanks

Imran
TestTranspose.xlsx
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40370486
It's because you have two line gaps in rows 75 and 76.
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40370489
Same around row 491
0
 

Author Comment

by:Fridaybird
ID: 40370507
I am an idiat :( Apology.
0
 

Author Comment

by:Fridaybird
ID: 40370797
I've requested that this question be closed as follows:

Accepted answer: 0 points for Fridaybird's comment #a40370507
Assisted answer: 250 points for Phillip Burton's comment #a40370425
Assisted answer: 250 points for Phillip Burton's comment #a40370433

for the following reason:

Very quick and accurate response. Both Experts came up with wealth knowledge and courtesy. My salutes to both Philip Burton and Topper88.
0
 
LVL 2

Accepted Solution

by:
Pratik Makwana earned 500 total points
ID: 40370584
Pls run this macro in your excel, its will copy data from sheet1 and transpose & paste it into sheet2......

Sub Traspose()
i = 1
y = 1
x = 1

For i = 1 To Sheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Row
    If IsEmpty(Sheets("sheet1").Cells(i, 1)) Then
    y = 1
    x = x + 1
    Sheets("sheet1").Cells(i, 1).Copy Destination:=Sheets("sheet2").Cells(x, y)
    Else
    Sheets("sheet1").Cells(i, 1).Copy Destination:=Sheets("sheet2").Cells(x, y)
    y = y + 1
    End If
Next

End Sub
0
 

Author Closing Comment

by:Fridaybird
ID: 40370798
Thanks, issue was resolved
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Nadia
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every mont…
Viewers will learn the basics of formula auditing in Excel 2013.
Viewers will learn a basic data manipulation technique of unpivoting data in Power Query for Excel 2013 and the importance of using good data. Start with data in a poor structure: Create a table on your data: Unpivot columns: Rename columns: …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question