Transpose but with two columns intact side by side

tlyee

New Member
Joined
Oct 5, 2006
Messages
8
Hi,

How do I make the data below to transpose with two columns still intact?

Please see image below:



Please help... Thanks!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Marc

Active Member
Joined
Feb 21, 2002
Messages
388
It probably could be automated and I'm not sure how much data you're working with, but these steps should get the job done.

1. Copy the two rows.
2. Select where you want them pasted.
3. Right Click, choose Paste Special, transpose.
4. Next to 92.1 place formula where cell = value below 92.1 (15).
5. Do the same thing for 80.2, so that you have 12 sitting in the cell next to 80.2
6. Highlight the four cells containing the 15, blank, 12 and blank and copy them down as far as you need to go.
7. Copy this new third column and paste special values.
8. Delete every other row.
9. In the first column do a 'replace' to have the 'mean' replaced with nothing.
 

tlyee

New Member
Joined
Oct 5, 2006
Messages
8
Hi Marc,

Thank you! It works! Of course it would be nice if it is automated as I have about 100 sets of data monthly.

Wondering if you know or anyone out here can help with my other scenario..

If I paste my data to cell D5, need to keep all data in column A, B and C. How would I delete every other row and lift the cells up (rows which contain the "n") underneath column D using some macros?

Hope this makes sense.

Thanks!
 

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
Hi -
try.
Code:
Sub test()
Dim i, n As Long
Range("d5:f" & Rows.Count).ClearContents
n = Range("A1").End(xlToRight).Column
Range("d5").Resize(, 3).Value = Array(Range("a1").Value, Range("a2").Value, Range("b2").Value)
For i = 3 To n Step 2
    Range("d" & Rows.Count).End(xlUp).Offset(1).Resize(, 3).Value = Array(Cells(1, i).Value, Cells(2, i).Value, Cells(2, i + 1).Value)
Next
End Sub
 

tlyee

New Member
Joined
Oct 5, 2006
Messages
8
Thank you!! It works!!! A couple of questions about modifying the codes.

1) What if I need to paste it into another sheet in the workbook? What would the code looks like?

2) Which cell # do I need to change when I need to switch the destination.
Say, instead of D5, I need to change it to some other cell, say F5

3) What if my data starts in row L3, I would need to capture the data, transpose to cell F5?

I tried changing the d5:f to f5:h, range ("d5") to "f5".. but no idea about the range "a1" and "a2" means.

Please educate. Thanks!!!
 

Forum statistics

Threads
1,144,611
Messages
5,725,304
Members
422,608
Latest member
bswg5882

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top