A simple transpose problem?

frank933

New Member
Joined
Oct 9, 2010
Messages
27
Guys I have a simple transpose problem to resolve. I hope I can find an answer here.

I have dataset in a bunch of rows but only 2 columns like so:
1735260889002.png


I would like to transpose? it and arrange it like so:

1735260989512.png


Is there a formula I can use on multiple rows to arrange the data in the above format?

Thank you all
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
If you have a version of Excel that supports the TOROW function:

Book2
ABCDEFGH
1A1B1
2A2B2
3A3B3
4A4B4
5
6A1B1A2B2A3B3A4B4
Sheet1
Cell Formulas
RangeFormula
A6:H6A6=TOROW(A1:B4)
Dynamic array formulas.
 
Upvote 0
VBA solution :

VBA Code:
Option Explicit

Sub TransposeColumnsAB()
    Dim i As Long
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row
    
    For i = 1 To lastRow
        Cells(1, (i - 1) * 2 + 1).Value = Cells(i, 1).Value
        Cells(1, (i - 1) * 2 + 2).Value = Cells(i, 2).Value
    Next i
End Sub
 
Upvote 0
VBA solution :

VBA Code:
Option Explicit

Sub TransposeColumnsAB()
    Dim i As Long
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row
   
    For i = 1 To lastRow
        Cells(1, (i - 1) * 2 + 1).Value = Cells(i, 1).Value
        Cells(1, (i - 1) * 2 + 2).Value = Cells(i, 2).Value
    Next i
End Sub
Works great. Thank you Sir.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0

Forum statistics

Threads
1,225,374
Messages
6,184,606
Members
453,247
Latest member
scouterjames

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