+ Reply to Thread
Results 1 to 9 of 9

Join Cells in One Column Based on Info in 2nd Column

  1. #1
    Registered User
    Join Date
    04-07-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel for Mac 2011
    Posts
    9

    Question Join Cells in One Column Based on Info in 2nd Column

    Hello folks,

    Here's the issue I'd like to ask this forum for some help with:

    Column1 has text and Column2 has a Case number.

    The text is split into a new row after a certain amount of characters, even though the narrative doesn't end. The Case number is repeated for every row where the text is continued.

    The question is, can I get excel to combine each cell in the first column that has the same value in the case number column?

    I've attached an example of what I'm talking about, with 21 rows and 9 case numbers: Example.xls

    Thank you so much! I'd really appreciate any advice!

    Last edited by fedorzarkhin; 04-07-2012 at 08:36 PM.

  2. #2
    Registered User
    Join Date
    04-07-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel for Mac 2011
    Posts
    9

    Re: Join Cells in One Column Based on Info in 2nd Column

    Pulling my hair out!

  3. #3
    Registered User
    Join Date
    04-07-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel for Mac 2011
    Posts
    9

    Re: Join Cells in One Column Based on Info in 2nd Column

    I've found out how to do it if there are only 2 rows per entry that need to be merged: =IF(B2=B3,A2& " " & A3, A2)

    But how to do it if there are more? In the database I have there are up to 15...

    Anybody know?

  4. #4
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Join Cells in One Column Based on Info in 2nd Column

    Quote Originally Posted by fedorzarkhin View Post
    The text is split into a new row after a certain amount of characters(
    The real question is "Why is the data split this way?". Can I assume you are importing the data from another system and are trying to us it in Excel? If so, is it a once off extract or does it get updated repeatedly. If you could explain the situation a bit more, it would help.

    It is easy to create a macro to fix this, but I would like to know the source of the data and if it can be refreshed from the source first.

  5. #5
    Registered User
    Join Date
    04-07-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel for Mac 2011
    Posts
    9

    Re: Join Cells in One Column Based on Info in 2nd Column

    Mallycat – Thanks so much for responding.

    The municipal agency I got the data from probably did extract it from another system. I got an excel file from them, though, and I don't have access to the original database.

    What exactly is a macro, and how would I use one here?

    Thanks!

  6. #6
    Registered User
    Join Date
    04-05-2012
    Location
    Phnom Penh, Cambodia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Join Cells in One Column Based on Info in 2nd Column

    I think your problem solution can be found here:
    http://msaccessexcell.blogspot.com/2...-ms-excel.html

    But what you need to do is to move your 2nd column to 1st column and formula around there will help you to combine it..

  7. #7
    Registered User
    Join Date
    04-05-2012
    Location
    Phnom Penh, Cambodia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Join Cells in One Column Based on Info in 2nd Column

    I think your problem solution can be found here:
    http://msaccessexcell.blogspot.com/2...-ms-excel.html

    But what you need to do is to move your 2nd column to 1st column and formula around there will help you to combine it..

  8. #8
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Join Cells in One Column Based on Info in 2nd Column

    Quote Originally Posted by fedorzarkhin View Post
    What exactly is a macro, and how would I use one here?
    A macro (or VBA) is a program that can manipulate your data. It will convert it from what you have to what you want.

    If you don't know what VBA is, then you wont know what to do with the code below. Take a look at this site I created a few years ago on how you can access the VBA editor and paste the code.

    http://mixednuts.net.au/matts_stuff/vba.php

    Here is the VBA code that will combine the cells for you.
    Note, it assumes you data is exactly like you have it in your sample sheet. Ie it starts in cell A1 and has 2 columns of data.

    Please Login or Register  to view this content.
    Once you paste the code into the VBA editor (see my website above), you should be able to run the code from the menu. I am not sure if the VBA menu is visible by default in a Mac version. In case you can't work it out, I have added your sample book here with the code included and a button to run the code. At least you will see how it works, and maybe then can work it out from there.
    Attached Files Attached Files
    Last edited by Mallycat; 04-08-2012 at 12:32 AM.

  9. #9
    Registered User
    Join Date
    04-07-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel for Mac 2011
    Posts
    9

    Re: Join Cells in One Column Based on Info in 2nd Column

    Mallycat –

    Holy cow. And that's what you call easy, haha. Thanks a lot for figuring this out for me and for opening my eyes to this world of macros...

    Thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1