Row to column like in the output

Arunchira

New Member
Joined
Aug 25, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Row1 2 6 7
Row 2 20 5 8
Row 3 10
Row 4 45 46
Do you know the name of this Converon
Row 1 2
6
7
Row2. 20
5
8
Row3. 10
Row4. 45
46
 

Attachments

  • IMG_1078.jpeg
    IMG_1078.jpeg
    160.9 KB · Views: 11

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Change references as and where required.
Code:
Sub Maybe()
Dim i As Long, sh2 As Worksheet, lc As Long
Set sh2 = Worksheets("Sheet2")
    For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        lc = Cells(i, Columns.Count).End(xlToLeft).Column
            sh2.Cells(Rows.Count, 2).End(xlUp).Offset(1, -1).Resize(, 2).Value = Cells(i, 1).Resize(, 2).Value
        If lc > 2 Then sh2.Cells(Rows.Count, 2).End(xlUp).Offset(1).Resize(lc - 2).Value = Application.Transpose(Cells(i, 3).Resize(, lc - 2).Value)
    Next i
End Sub
 
Upvote 0
Try this?
Excel Formula:
=LET(
_a,A1:D3,
_b,TOCOL(EXPAND(TAKE(_a,,1),,COLUMNS(_a)-1,"")),
_c,TOCOL(DROP(_a,,1)&""),
FILTER(HSTACK(_b,_c),_c<>""))
 
Upvote 0
Similar as Post #2 but different.
Change references as and where required.
Code:
Sub Maybe()
Dim i As Long, sh2 As Worksheet
Set sh2 = Worksheets("Sheet2")
    For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        With sh2.Cells(Rows.Count, 2).End(xlUp).Offset(1)
            .Offset(, -1).Value = Cells(i, 1).Value
            .Resize(Cells(i, Columns.Count).End(xlToLeft).Column - 1).Value = _
            Application.Transpose(Cells(i, 1).Offset(, 1).Resize(, Cells(i, Columns.Count).End(xlToLeft).Column - 1).Value)
        End With
    Next i
End Sub
 
Upvote 0
Welcome to the MrExcel board!

Assuming rows are filled from the left and each row has a value in column B at least, like your sample data, then another formula option to consider might be ...

23 08 26.xlsm
ABCD
1Name1arunrobsarah
2Name2danny
3Name3nickdavid
4
5
6Name1arun
7rob
8sarah
9Name2danny
10Name3nick
11david
12
Arunchira
Cell Formulas
RangeFormula
A6:B11A6=HSTACK(TOCOL(IF(COLUMN(B1:D3)>COLUMN(B1),IF(B1:D3="",x,""),A1:A3),2),TOCOL(B1:D3,1))
Dynamic array formulas.
 
Upvote 0
One more alternative is with Power Query to unpivot your data

Import your data to PQ editor (Get and Transform Data and found on the Data Tab of the ribbon)
Select first column and then on the Transform Tab, select Unpivot --> Unpivot other columns
On the Home tab, select Close and Load. Select your location.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Column1"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"})
in
    #"Removed Columns"
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,365
Members
449,155
Latest member
ravioli44

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