Converting raw data from row oriented to column oriented

joshuaba

New Member
Joined
Mar 6, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
HI guys,

I have a file that has a tremendous amount of rows and I'd like to switch the raw data from row oriented to column oriented for ease of analysis.

In my example, my raw data has content fields for numerous products. For example, for one product, I will be tracking the Product Title, # of Bullets, # of Images, e.t.c. There are a total of 15 content fields, represented by 15 rows for a specific product, but sometimes some products will report fewer. I mention this, because I can't use Excel's transpose function as the content fields are not consistent.

Can you advise if switching my row oriented data to column oriented is possible within Excel? You can technically achieve this view with a pivot table on the original raw data, but because pivot tables use numeric values to populate the cells, I can't use it for text.


I've attached an image to give an example - I'm looking forward to any insight/help members can provide!
 

Attachments

  • row vs column.JPG
    row vs column.JPG
    241.7 KB · Views: 10

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
1,777
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Welcome to MrExcel Message Board.
if your First 15 Cells at Column G is Complete List for Column Headers from Column Q to AE Then
Try This:
VBA Code:
Sub TransPosedData()
Dim i As Long, j As Long, Lr As Long, K As Long, FM As Long, LM As Long
Lr = Range("A" & Rows.Count).End(xlUp).Row

K = 1
'if your First 15 Cells at Column G is Complete Then
Range("K1:P1").Value = Range("A1:F1").Value
Range("Q1:AE1").Value = Application.WorksheetFunction.Transpose(Range("G2:G16").Value)
For i = 2 To Lr
If Range("E" & i - 1).Value <> Range("E" & i).Value Then
K = K + 1
Range("K" & K & ":P" & K).Value = Range("A" & i & ":F" & i).Value
FM = Application.WorksheetFunction.Match(Range("O" & K).Value, Range("E1:E" & Lr), 0)
LM = Application.WorksheetFunction.CountIf(Range("E2:E" & Lr), Range("O" & K).Value) + FM - 1
For j = 17 To 31
On Error Resume Next
Cells(K, j).Value = Application.WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(Cells(1, j).Value, Range("G" & FM & ":H" & LM), 2, False), """")
Next j
i = LM
End If
Next i
End Sub
[/CODE]
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,129,441
Messages
5,636,305
Members
416,912
Latest member
danluk12

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
Top