?
Solved

Excel: Combine Columns Vertically

Posted on 2016-09-27
2
Medium Priority
?
116 Views
Last Modified: 2016-09-27
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
Comment
Question by:waltforbes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 41819023
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

Open in new window

0
 

Author Closing Comment

by:waltforbes
ID: 41819065
Hi Wayne Taylor, I tested the simpler function option and it worked like magic. I was so amazed.
What is your expertise/profession? What explains your knowledge of this esoteric area? (please, sir) :-)

I am so grateful. A thousand thanks!
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question