• Status: Solved
• Priority: Medium
• Security: Public
• Views: 154

# Excel: Combine Columns Vertically

Points of My Scenario
1. I have a spreadsheet with 2 (two) columns, A and B
2. I need to generate a column, C, that has alternating values/rows of columns A and B
Point of Clarification: If columns A and B each have 10 rows, then column C should have 20 rows

QUESTION: How do I accomplish this in Microsoft Excel?
0
waltforbes
1 Solution

Commented:
You could use this formula in column C and copy down as required....

=IF(MOD(ROW(), 2)=1, INDEX(A:A, EVEN(ROW())/2), INDEX(B:B, EVEN(ROW())/2))

...or use this macro...

``````Sub AlternateRows()

Dim rw As Long
For rw = 1 To Cells(Rows.Count, "A").End(xlUp).Row
With Cells(Rows.Count, "C").End(xlUp)
.Offset(1, 0) = Cells(rw, "A")
.Offset(2, 0) = Cells(rw, "B")
End With
Next

End Sub
``````
0

Senior IT SpecialistAuthor Commented:
Hi Wayne Taylor, I tested the simpler function option and it worked like magic. I was so amazed.

I am so grateful. A thousand thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.