+ Reply to Thread
Results 1 to 19 of 19

Merging to Rows of Data

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Merging to Rows of Data

    I originally posted this in excel 2007 help but this might be a better place to ask it.

    I have 2 different lists in excel.

    The first one has all the business info, name, address, phone number, etc...
    The next has the business phone number and rank in Google.

    I combine both lists into 1 sheet and then add a function =IF(Phone Number is Equal to Phone Number above then Yes, if not No)

    Is there a way to combine both rows when the answer to the IF function is Yes?

    I have attached an excel file I have been trying to figure this out with.Excel Mege Test.xlsx

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,421

    Re: Merging to Rows of Data

    Now go back to your earlier thread in Excel 2007 and explain that you have posted here (include a link to this one) and that the thread is no longer valid, so that you can't be accused of double-posting.

    Pete

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    You got it Pete

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    Shouldnt Sheet2 - A4 be "Yes" in your file?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    Sorry, I forgot to change the info over to sheet 1. Here's the new excel file with it in sheet 1Excel Mege Test.xlsx

    As to your question, a4 should be no because N4 is not equal to N3. It's a different phone number.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button.

  7. #7
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    It worked on the list of 4 results.

    Then I tested it on 20 results and this is what the error message said: http://screencast.com/t/KRVu6NWD
    Then when I hit debug this is what it highlighted: http://screencast.com/t/gb96v6w4hI

    I attached the next list of 20 results. Excel Mege Test 2.xlsx

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    That was weird.

    Just change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    Okay...so it worked on the list of 20 and I went to try it on my list of 177 and got this error: http://screencast.com/t/6qpdfsqkO

    When I hit debug it highlighted the name of the worksheet 'Sheet1'

    I noticed that I had saved the csv file so it named the worksheet the name of the file.

    When I renamed the worksheet to 'Sheet1' nothing changed.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    Did you rename the sheet and re-run the macro? Did you name it exactly as Sheet1?

  11. #11
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    Yes...renamed it exactly and ran it again and nothing. Just another bug.

    I did copy and paste all the data into a new spreadsheet and run it and it worked fine.

    Was just wondering why it didn't work when it was saved.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    What is the bug you got when you ran it from the saved file?

  13. #13
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    Another question.

    I have another list: Denver Chiro Merged.xlsx

    When I run the combine the row thing on this list it only combines
    the top row. Here is the result of running this Macro: Denver Chiro Merged 2.xlsx

    Thank you so much for your help with this!

  14. #14
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    Any ideas why it is only merging rows 1 & 2?

    Sorry to keep asking. I have a deadline for tomorrow for my boss to merge a bunch of lists together.

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Merging to Rows of Data

    It is merging correctly. The condition put is that it should check column N. If the phone number in row 2 is the same as row 3, merge them.

    Check column N, there are different phone numbers there.

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Merging to Rows of Data

    How about this?
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    In the last example, the phone number in Row 3 is the same as Row 2.

    So Row 3 should merge with Row 2.

    Was it going the other way around before?

    Where Row 2 would merge with Row 3? I guess it doesn't really matter.

    When I run the Macro it just didn't merge the listings like it did before. I just noticed 1 listing merged.

  18. #18
    Registered User
    Join Date
    06-11-2012
    Location
    Honolulu, Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Merging to Rows of Data

    jindon, where do I upload that code?

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Merging to Rows of Data

    Try the attached.

    Just click on A1.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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