Transpose Data to List

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
Below is a table that I am working with. Column A:X is the standard table I am working with. Cells B2:H2 are the "day" of the month. Cells A4:U39 are the machines and hours that I need to review. I need to transpose all fields that are not 0 between B4:H39 and O4:U39 over to a running table as you can see in AB2:AD82. I am hoping I am explaining this well enough.




9/14/20238910111213149/14/2023891011121314Machine 49/8/202324
Tool Name FSSMTWTTotal UpTotal Dn% UpNotes Tool Name FSSMTWTTotal UpTotal Dn% UpMachine 49/9/202324
Machine 300000001680100.0%Machine 3900000001680100.0%Machine 49/10/202324
Machine 42424242424242401680.0%Machine 4000000001680100.0%Machine 49/11/202324
Machine 52424242424242401680.0%Machine 4100000001680100.0%Machine 49/12/202324
Machine 600000001680100.0%Machine 4200000001680100.0%Machine 49/13/202324
Machine 700000001680100.0%Machine 4300000001680100.0%Machine 49/14/202324
Machine 800000001680100.0%Machine 4424242424242402414414.3%Machine 59/8/202324
Machine 900000001680100.0%Machine 452424242424242401680.0%Machine 59/9/202324
Machine 1000000001680100.0%Machine 4600000001680100.0%Machine 59/10/202324
Machine 1100000001680100.0%Machine 4700000001680100.0%Machine 59/11/202324
Machine 1200000001680100.0%Machine 4800000001680100.0%Machine 59/12/202324
Machine 1300000001680100.0%Machine 4900000001680100.0%Machine 59/13/202324
Machine 1400000001680100.0%Machine 5000000001680100.0%Machine 59/14/202324
Machine 1500000001680100.0%Machine 5100000001680100.0%Machine 169/8/202324
Machine 162424242424242416800.0%Machine 5200000001680100.0%Machine 169/9/202324
Machine 172424242424242416800.0%Machine 5300000001680100.0%Machine 169/10/202324
Machine 182424242424242416800.0%Machine 5400000001680100.0%Machine 169/11/202324
Machine 192424242424242401680.0%Machine 5500000001680100.0%Machine 169/12/202324
Machine 2000000001680100.0%Machine 5600000001680100.0%Machine 169/13/202324
Machine 2100000001680100.0%Machine 5700000001680100.0%Machine 169/14/202324
Machine 22242424242424241680100.0%Machine 5800000001680100.0%Machine 179/8/202324
Machine 23500016001472187.5%Machine 5900000001680100.0%Machine 179/9/202324
Machine 2400000001680100.0%Machine 6000000001680100.0%Machine 179/10/202324
Machine 25011800001491988.7%Machine 6100000001680100.0%Machine 179/11/202324
Machine 2656000001571193.5%Machine 6200000001680100.0%Machine 179/12/202324
Machine 27248000001363281.0%Machine 6300000001680100.0%Machine 179/13/202324
Machine 28Machine 64242424242424241680100.0%Machine 179/14/202324
Machine 29Machine 6500000001680100.0%Machine 189/8/202324
Machine 30Machine 6600000001680100.0%Machine 189/9/202324
Machine 31Machine 6700000001680100.0%Machine 189/10/202324
Machine 3200000001680100.0%Machine 189/11/202324
Machine 3300000001680100.0%Machine 189/12/202324
Machine 345242480001076163.7%Machine 189/13/202324
Machine 3500000001680100.0%00000001680100.0%Machine 189/14/202324
Machine 3600000001680100.0%00000001680100.0%Machine 199/8/202324
Machine 3700000001680100.0%00000001680100.0%Machine 199/9/202324
Machine 3800000001680100.0%00000001680100.0%Machine 199/10/202324
Machine 199/11/202324
Machine 199/12/202324
Machine 199/13/202324
Machine 199/14/202324
Machine 229/8/202324
Machine 229/9/202324
Machine 229/10/202324
Machine 229/11/202324
Machine 229/12/202324
Machine 229/13/202324
Machine 229/14/202324
Machine 239/8/20235
Machine 239/12/202316
Machine 259/9/202311
Machine 259/10/20238
Machine 269/8/20235
Machine 269/9/20236
Machine 279/8/202324
Machine 279/9/20238
Machine 349/8/20235
Machine 349/9/202324
Machine 349/10/202324
Machine 349/11/20238
Machine 449/8/202324
Machine 449/9/202324
Machine 449/10/202324
Machine 449/11/202324
Machine 449/12/202324
Machine 449/13/202324
Machine 459/8/202324
Machine 459/9/202324
Machine 459/10/202324
Machine 459/11/202324
Machine 459/12/202324
Machine 459/13/202324
Machine 459/14/202324
Machine 649/8/202324
Machine 649/9/202324
Machine 649/10/202324
Machine 649/11/202324
Machine 649/12/202324
Machine 649/13/202324
Machine 649/14/202324
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
How about
Excel Formula:
=LET(a,VSTACK(A4:H39,N4:U39),b,TAKE(a,,1),c,DROP(a,,1),HSTACK(TOCOL(IF(c<>0,b,1/0),2),TOCOL(IF(c<>0,DATE(YEAR(A2),MONTH(A2),B2:H2),1/0),2),TOCOL(IF(c<>0,c,1/0),2)))
 
Upvote 0
Solution
How about
Excel Formula:
=LET(a,VSTACK(A4:H39,N4:U39),b,TAKE(a,,1),c,DROP(a,,1),HSTACK(TOCOL(IF(c<>0,b,1/0),2),TOCOL(IF(c<>0,DATE(YEAR(A2),MONTH(A2),B2:H2),1/0),2),TOCOL(IF(c<>0,c,1/0),2)))
This is awesome! This workbook has maybe 100 sheets with the saem exact format. Is there possibly a way to use this to create one large table for ALL sheets?
 
Upvote 0
Are the all the sheets consecutive & are the dates in A2 & the numbers in B2:H2 the same on all sheets?
 
Upvote 0
Are the all the sheets consecutive & are the dates in A2 & the numbers in B2:H2 the same on all sheets?
Hi Fluff,

There were a few modifications I ended up doing, but I was able to get it to run using dummy code seen below:
Excel Formula:
=LET(a,VSTACK(A12:H59,N12:U55),b,TAKE(a,,1),c,DROP(a,,1),HSTACK(TOCOL(IF(c<>0,b,1/0),2),TOCOL(IF(c<>0,DATE(YEAR(A10),MONTH(A10),B10:H10),1/0),2),TOCOL(IF(c<>0,c,1/0),2)))

Then I ensure all worksheets were named with a date and placed that date in A10:
VBA Code:
Sub Redate()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
    
If ws.Name = "Data Table" Then

Exit Sub

Else
    
    ws.Select
   Range("A10").Value = (ActiveSheet.Name)

End If

Next ws
End Sub

And then after that I added the original formula you provided to AC2 for all sheets by selecting all insert. Then I ran a code to find all of those values and add them to a "Data Tables" tab.

VBA Code:
Sub Copy_All_Date()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
    
    If ActiveSheet.Name = "Data Table" Then
    
    Exit Sub
    
    Else
    
        lastrow = Range("AC" & Rows.Count).End(xlUp).Row
        Range("AC2:AE" & lastrow).Copy
        
        'Sheets("Data Table").Select
        
        lastrow2 = Sheets("Data Table").Range("A" & Rows.Count).End(xlUp).Row
        Sheets("Data Table").Range("A" & lastrow2 + 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
    Sheets(ActiveSheet.Index + 1).Activate
    
    End If
    
    
Next ws


End Sub

Last thing I had to do was remove duplicates that I don't know why or where they came from. But it got me 18000 lines of data I needed.

Thank you!
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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