+ Reply to Thread
Results 1 to 17 of 17

Merge cells in a table based on number of common values

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Merge cells in a table based on number of common values

    Hi,

    I wanted to merge part of the table which has the cells with common values.

    Attached the sheet with original and proposed table.

    Pls help me in getting this through macro.merge doubt.xlsx

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge cells in a table based on number of common values

    I do not recommend to merge cells, but your choice.
    Attached Files Attached Files
    Last edited by AB33; 11-02-2013 at 01:26 PM.

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    Thanks for the response. This works fine with the given example. I need to do this with 1000 rows table and the data keeps changing. Can you please help me for a dynamic sheet?

    Also, the reason for merging is to copy the whole table and paste it in word to send as a report.

    Thanks.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge cells in a table based on number of common values

    I do not know how the dynamic sheet looks like. Could you post it?

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    The number of rows and data might change. attached another sample. There will be 1000+ rows like this.
    dynamic sheet.xlsx

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge cells in a table based on number of common values

    Try this:-
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Thumbs up Re: Merge cells in a table based on number of common values

    you are rocking expert.

  8. #8
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    I have a requirement which I missed in my previous ask. Since it is complex I am not able to try it myself. Need expert's help.
    Here if the Measurement is "Height", the corresponding ID1 and ID2 should be deleted. Basically the output should have only IDs of Weight and Breadth.

    Attached the excel. Need macro to automate this.

    Thanks in advance.
    Attached Files Attached Files

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

    Re: Merge cells in a table based on number of common values

    Do not recommend to use "merge" as a procedure name since it is a vba reserved word.

    Try the attached
    Attached Files Attached Files

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

    Re: Merge cells in a table based on number of common values

    If the code solved your problem, mark this thread as "Solved", as well as http://www.excelforum.com/excel-prog...r-columns.html

  11. #11
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    Thanks. This works partially. If it merges the rest of the columns "Height", "Weight", "Breadth" and "Total", that would be awesome.

  12. #12
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    sure will do. How to mark it as solved?

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,771

    Re: Merge cells in a table based on number of common values

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    Re: Merge cells in a table based on number of common values

    I've never done it, but if you go to your 1st post and [Edit], you should see the option. I guess.

    Change to
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    Hi Jindon,

    I am sorry that I am bugging you with more questions/requirements. Just realized that I missed to ask about handling "Height" Column in output table.
    Attached the spreadsheet with requirement (eg. Peter). Pls help. Thanks in advance.
    Attached Files Attached Files

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

    Re: Merge cells in a table based on number of common values

    You need to explain why your result includes A24 /B24 for "Sebastian".

    This doesn't include that line in the result.
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Merge cells in a table based on number of common values

    A24 /B24 for "Sebastian" was included by mistake.

    Your code solved by problem. Thanks expert.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Merge two table with a common column
    By Peppezass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2013, 10:23 AM
  2. [SOLVED] Excel - Merge rows with common values and concatenate the differences in one column
    By ashina in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2013, 07:01 AM
  3. Merge Cells based on an adjacent row of values
    By Metal Head in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2011, 09:55 AM
  4. Need to merge variable number of cells into one single cell based on criteria
    By NewYorkVanilla in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2009, 11:05 AM
  5. Merge cells based on number of characters
    By Horace1894 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2009, 10:37 AM

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