Collating data vertically not horizontally

rovert

New Member
Joined
Aug 4, 2009
Messages
22
Afternoon All,

Thank you in advance, i need help in presenting my data vertically and not horizontally. Fig1 is how my data is at the moment, however i need to present it like Fig2.

Fig1
[TABLE="width: 572"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]KNr[/TD]
[TD]Driveshaft[/TD]
[TD]CV Joint[/TD]
[TD]Boot Kit[/TD]
[TD]Hub Nuts[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1381N[/TD]
[TD]BK14[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1159N[/TD]
[TD]BK14[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1381N[/TD]
[TD]BK650[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1159N[/TD]
[TD]BK650[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1381N[/TD]
[TD]CBK7000[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1159N[/TD]
[TD]CBK7000[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1381N[/TD]
[TD]SB04[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD]10447[/TD]
[TD]VA181L[/TD]
[TD]CV1159N[/TD]
[TD]SB04[/TD]
[TD]HN02[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fig2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 3"]Required Result[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]Hub Nuts[/TD]
[TD]HN02[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]Boot Kit[/TD]
[TD]BK14[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]Boot Kit[/TD]
[TD]BK650[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]Boot Kit[/TD]
[TD]CBK7000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]Boot Kit[/TD]
[TD]SB04[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]CV Joint[/TD]
[TD]CV205N[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]CV Joint[/TD]
[TD]CV1159N[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VA181L[/TD]
[TD]CV Joint[/TD]
[TD]CV1381N[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try this

I guess the data starts on sheet 1 in row 2.
Change the name sheet1 for the sheet with data and the name sheet2 for the sheet with the result.


Code:
Sub Collating_data()
  Dim sh1 As Worksheet, sh2 As Worksheet, i As Long, llave As String, ky As Variant, dict As Object
  Set sh1 = Sheets("[COLOR=#ff0000]Sheet1[/COLOR]")
  Set sh2 = Sheets("[COLOR=#ff0000]Sheet2[/COLOR]")
  sh2.Rows("2:" & Rows.Count).ClearContents
  Set dict = CreateObject("scripting.dictionary")
  For i = 2 To sh1.Range("B" & Rows.Count).End(xlUp).Row
    dict.Item(sh1.Cells(i, "B") & "|" & sh1.Cells(1, "E") & "|" & sh1.Cells(i, "E")) = Empty
    dict.Item(sh1.Cells(i, "B") & "|" & sh1.Cells(1, "D") & "|" & sh1.Cells(i, "D")) = Empty
    dict.Item(sh1.Cells(i, "B") & "|" & sh1.Cells(1, "C") & "|" & sh1.Cells(i, "C")) = Empty
  Next
  sh2.Range("A2").Resize(dict.Count) = Application.Transpose(dict.Keys)
  sh2.Range("A:A").TextToColumns sh2.Range("A1"), xlDelimited, xlNone, , , , , , True, "|"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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