Transpose columns to rows with a twist

MPFraser7

New Member
Joined
Dec 14, 2016
Messages
34
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]User

[/TD]
[TD]App1
[/TD]
[TD]App2
[/TD]
[TD]App3
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]Safari
[/TD]
[TD]Chrome
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]Safari
[/TD]
[TD][/TD]
[TD]Edge
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD][/TD]
[TD]Chrome
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I have a similar table in excel, and I want to quickly convert it to this:

User App
A Safari
A Chrome
B Safari
B Edge
C Chrome

Any ideas?
 
Last edited:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Sorry, I couldn't add a second table but there are 2 columns: User and App, and 6 rows. Since user A has access to two apps, there are two rows for him. Let me know if this isn't clear.
 
Upvote 0
VBA solution, input on Sheet1, output on Sheet2

Code:
Sub k1()
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
k = 0
For i = 2 To lastrow
For j = 2 To 4
If Worksheets("Sheet1").Cells(i, j) <> "" Then
    k = k + 1
    Worksheets("Sheet2").Cells(k, 1) = Worksheets("Sheet1").Cells(i, 1)
    Worksheets("Sheet2").Cells(k, 2) = Worksheets("Sheet1").Cells(i, j)
End If
Next j
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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