+ Reply to Thread
Results 1 to 4 of 4

macro or formula to combine 2 cell (down) on a merged cell

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    18

    macro or formula to combine 2 cell (down) on a merged cell

    hi all members,

    having trouble in combining several cell-down into one cell on a sheet involving merged cell.

    my attemp is using this formula [=IF(IsMerged(E7),D7&"-"&D8,""] but this is not giving the result I am hoping for.

    to get the picture, please have a look on the attached sample workbook
    samplerampal.xlsm

    p.s: the borders on the attached worksbook does not nessecary, i just made it for easy viewing.
    and my knowldge in formula and macro is way below basic

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: macro or formula to combine 2 cell (down) on a merged cell

    This formula will not merge the cells for you (you'll need a macro to do that) but will put all the values in the right places. I put it in G7 copied down

    =IF(AND(IsMerged(B7),NOT(ISBLANK(B7))), A7 &"-"&A8 &IF(ISBLANK(B9), "-"&A9,"")& IF(AND(ISBLANK(B9), ISBLANK(B10)),"-"&A10,""),"")
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-05-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: macro or formula to combine 2 cell (down) on a merged cell

    hi ChemistB,

    your formula works like charm and it solved my problem. (i just want to combine all the values in to one cell, so doesn't matter if cell is not merged)

    a bunch of thanks to you .......!

    regards
    rampal

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: macro or formula to combine 2 cell (down) on a merged cell

    Try this array formula

    {=CHOOSE(SMALL(IF(LEN($B7:$B$24)>0,ROW($B7:$B$24),MAX(IF(LEN(A$7:A$24)>0,ROW(A$7:A$24),0))+1),2)-ROW(B7),A7,A7&"-"&A8,A7&"-"&A8&"-"&A9,A7&"-"&A8&"-"&A9&"-"&A10)}

+ 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