Transposing Data using Paste Special and Formula?

Barghouti

New Member
Joined
Dec 10, 2015
Messages
3
Hello,

I'm new to Excel. What I'm trying to do is take a set of data that looks just like this, but keeps going with every country...


...and to take the following data and add it as a third column above:

Afghanistan0.230.230.2960.3410.3960.4060.4160.430.4370.4530.4580.4660.468
Albania0.6030.6020.6090.6550.6890.6940.6990.7030.7050.7080.7140.7140.716
Algeria0.5090.5510.5760.6340.6750.680.6860.6950.7030.7090.7150.7150.717
Andorra..................0.8320.8310.830.83
Angola......0.3770.4460.4650.4780.490.4910.5040.5210.5240.526
Antigua and Barbuda..................0.7780.7720.7730.774
Argentina0.6650.6880.6940.7530.7580.7660.7710.7770.7890.7990.8040.8060.808
Armenia....0.6320.6480.6930.7070.7210.7220.7170.720.7240.7280.73
Australia0.8410.8530.8660.8980.9120.9150.9180.9220.9240.9260.9280.9310.933
Austria0.7360.7540.7860.8350.8510.8570.8610.8680.870.8770.8790.880.881
Azerbaijan......0.6390.6860.7030.7150.7240.7360.7430.7430.7450.747
Bahamas......0.7660.7870.7890.7910.7910.7880.7880.7890.7880.789
Bahrain0.6770.7180.7290.7840.8110.8080.8090.810.8110.8120.8120.8130.815
Bangladesh0.3360.3570.3820.4530.4940.5020.510.5150.5270.5390.5490.5540.558
Barbados0.6580.6880.7060.7450.7610.7640.7710.7760.7820.7790.780.7760.776
Belarus........0.7250.7380.7510.7640.7750.7790.7840.7850.786
Belgium0.7530.7730.8050.8730.8650.8680.8710.8730.8730.8770.880.880.881

<tbody>
</tbody>


I hope this makes sense, I know I'm very new to this so I'm not sure if I'm explaining correctly.

I know there's a way to do it but I think there's a formula, and you have to do a Paste Special and Transpose. Any help would be appreciated! Thank you very much!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Also, I know I can do it country by country, but that's going to take forever, and I saw someone do it using a formula so I'd much rather use that.
 
Upvote 0
Barghouti

Country and Year data assumed to be in Sheet1 and Country and Decimal Values in Sheet2 (both starting from cell A1)

Copy this macro in macro Module:

Sub TransposeCopy()
Application.ScreenUpdating = False
Dim n As Long
n = 1
Do Until Sheets("Sheet2").Range("A" & n) = ""
Sheets("Sheet1").Select
Range("A:A").Select
Cells.Find(What:=Sheets("Sheet2").Range("A" & n), LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True).Activate
ActiveCell.Offset(0, 2).Activate
Sheets("Sheet2").Select
Range(Range("A" & n).Offset(0, 1), Range("A" & n).Offset(0, 13)).Copy

Sheets("Sheet1").Activate
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
n = n + 1
Loop
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Then run the macro. Hope it helps!
 
Upvote 0
Partho,

Thanks for being willing to help me. I'm using Excel 2008 for Mac, 12.0. On the Menu bar, I clicked on Tools, selected Macros, and then a box came up where I could input the macro. I tried but the Run button remains greyed out and it won't let me click it. I have 3 bottom tabs open: Sheet1, Sheet2, Data.


Barghouti

Country and Year data assumed to be in Sheet1 and Country and Decimal Values in Sheet2 (both starting from cell A1)

Copy this macro in macro Module:

Sub TransposeCopy()
Application.ScreenUpdating = False
Dim n As Long
n = 1
Do Until Sheets("Sheet2").Range("A" & n) = ""
Sheets("Sheet1").Select
Range("A:A").Select
Cells.Find(What:=Sheets("Sheet2").Range("A" & n), LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True).Activate
ActiveCell.Offset(0, 2).Activate
Sheets("Sheet2").Select
Range(Range("A" & n).Offset(0, 1), Range("A" & n).Offset(0, 13)).Copy

Sheets("Sheet1").Activate
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
n = n + 1
Loop
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Then run the macro. Hope it helps!
 
Upvote 0
Not sure why your macro run button is greyed out; I am not familiar with Mac. Do any other forum members know how to enable the button? Otherwise you could try researching this topic by Googling. By the way, if you are able to run the macro you may find the decimal numbers for the first country are out of alignment by one row; for some reason they start from row2 instead of row1, So you will have to manually fix the first country's numbers. The macro works as expected for all the other countries.
Meanwhile I will try to develop a formula for you which is capable of being copied into column C.
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

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
Back
Top