Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2023, 03:31 PM
LearnerExcel LearnerExcel is offline Need function that transpose the rows data of a table automatically. Windows 7 32bit Need function that transpose the rows data of a table automatically. Office 2013
Advanced Beginner
Need function that transpose the rows data of a table automatically.
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default Need function that transpose the rows data of a table automatically.

Hi,



I have the excel file with a table that contains 700 rows. Now, I need that data to be copied like shown in the picture. Manually copy data by using transpose is a very lengthy process and it needs to be completed urgently.

How to resolve this problem. Please support me.


Best regards.
Attached Images
File Type: png Querry.png (30.4 KB, 9 views)
Reply With Quote
  #2  
Old 07-07-2023, 06:55 PM
Alansidman's Avatar
Alansidman Alansidman is offline Need function that transpose the rows data of a table automatically. Windows 11 Need function that transpose the rows data of a table automatically. Office 2021
עַם יִשְׂרָאֵל חַי
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 79
Alansidman will become famous soon enoughAlansidman will become famous soon enough
Default

With Power Query
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"})
in
    #"Removed Columns"
Reply With Quote
  #3  
Old 07-07-2023, 07:07 PM
Logit Logit is offline Need function that transpose the rows data of a table automatically. Windows 10 Need function that transpose the rows data of a table automatically. Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Code:
Option Explicit

Sub MoveToASingleColumn()


    Dim ws1     As Worksheet
    Dim ws2     As Worksheet
    Dim arr()   As Variant
    
    Set ws1 = Sheets("Sheet1")
    Set ws2 = Sheets("Sheet2")
    
    Dim x   As Long
    Dim y   As Long
    Dim i   As Long
    
    x = ws1.Range("A" & Rows.Count).End(xlUp).Row
    y = ws1.Cells(1, Columns.Count).End(xlToLeft).Column
    
    arr = Cells(1, 1).Resize(x, y).Value
    
    i = 1
    For x = LBound(arr, 1) To UBound(arr, 1)
        For y = LBound(arr, 2) To UBound(arr, 2)
            If Len(arr(x, y)) <> 0 Then
                ws2.Cells(i, 1).Value = arr(x, y)
                i = i + 1
            End If
        Next y
    Next x
    
    Erase arr
    
    Set ws1 = Nothing
    Set ws2 = Nothing
    
End Sub
Attached Files
File Type: xlsm Transpose Rows To Single Column.xlsm (17.2 KB, 1 views)
Reply With Quote
  #4  
Old 07-08-2023, 04:24 AM
xor xor is offline Need function that transpose the rows data of a table automatically. Windows 11 Need function that transpose the rows data of a table automatically. Office 2021
Expert
 
Join Date: Oct 2015
Posts: 1,097
xor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to all
Default

If your table is named Table1 then:

=INDEX(Table1,INT((ROW(1:1)-1)/4)+1,MOD((ROW(1:1)-1),4)+1)

Copy down.

Last edited by xor; 07-08-2023 at 08:42 AM.
Reply With Quote
  #5  
Old 07-08-2023, 08:55 AM
LearnerExcel LearnerExcel is offline Need function that transpose the rows data of a table automatically. Windows 7 32bit Need function that transpose the rows data of a table automatically. Office 2013
Advanced Beginner
Need function that transpose the rows data of a table automatically.
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default

Quote:
Originally Posted by Logit View Post
Code:
Option Explicit

Sub MoveToASingleColumn()


    Dim ws1     As Worksheet
    Dim ws2     As Worksheet
    Dim arr()   As Variant
    
    Set ws1 = Sheets("Sheet1")
    Set ws2 = Sheets("Sheet2")
    
    Dim x   As Long
    Dim y   As Long
    Dim i   As Long
    
    x = ws1.Range("A" & Rows.Count).End(xlUp).Row
    y = ws1.Cells(1, Columns.Count).End(xlToLeft).Column
    
    arr = Cells(1, 1).Resize(x, y).Value
    
    i = 1
    For x = LBound(arr, 1) To UBound(arr, 1)
        For y = LBound(arr, 2) To UBound(arr, 2)
            If Len(arr(x, y)) <> 0 Then
                ws2.Cells(i, 1).Value = arr(x, y)
                i = i + 1
            End If
        Next y
    Next x
    
    Erase arr
    
    Set ws1 = Nothing
    Set ws2 = Nothing
    
End Sub
Thanks a million for your kind support. It is work great for me.

Best regards.
Reply With Quote
  #6  
Old 07-08-2023, 09:05 AM
Logit Logit is offline Need function that transpose the rows data of a table automatically. Windows 10 Need function that transpose the rows data of a table automatically. Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Best wishes !
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need function that transpose the rows data of a table automatically. Drop Down List to Automatically Populate Data in a Table src144 Word VBA 8 12-03-2020 04:15 PM
Transpose data form columns in rows matched with a key Alex1s85 Excel 7 11-26-2020 01:34 AM
Transpose multiple data form rows in columns matched with a key Alex1s85 Excel 6 06-24-2020 07:08 AM
need VBA to Transpose the Data from excel to word based on given criteria(status) winmaxservices2 Excel Programming 1 12-19-2014 10:21 PM
Need function that transpose the rows data of a table automatically. Data table search function omtinole Excel Programming 1 07-13-2012 10:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft