+ Reply to Thread
Results 1 to 3 of 3

conditionally combining text value of multiple cells

  1. #1
    Registered User
    Join Date
    06-01-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question conditionally combining text value of multiple cells

    I have a table
    A B C
    1 completed 5
    2 statement 0
    3 call 3
    4 w/off 1
    5 resubmission 0
    - -
    - -
    nth row

    I want to make a formula in cell C1 that if value in column B is more than 0 then text of respectiv column A should be combined

    output:-
    completed, call, w/off

    Note:- no of rows are not fixed
    Last edited by n.niks; 06-09-2012 at 06:50 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditionally combining text value of multiple cells

    First create a Dynamic Named Range so that you don't include more rows than necessary.... This will allow you to grow rows.

    Go to Formula Tab and then Define Name.. enter a name like MyList and enter formula in Refers to field like: =Sheet1!$A1:INDEX(Sheet1!$B:$B,COUNTA(Sheet1!$A:$A)) assuming data is in column A:B of Sheet1.

    then hold the Alt key and press F11 to get the VB Editor, go to Insert and select Module and paste this code in the Editor:

    Please Login or Register  to view this content.
    Close the editor.

    In cell C1 enter formula:

    =SUBSTITUTE(TRIM(aconcat(IF(INDEX(MyList,0,2)>0,INDEX(MyList,0,1),"")," "))," ",", ")

    and hold the CTRL and SHIFT keys down and hit ENTER. You should see { } brackets appear around the formula and get your results.

    Note that this method may be limited if you have excess number of rows....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-01-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: conditionally combining text value of multiple cells

    thanks a lot for replying, now I can solve my problem. This is best result.

    thanks once again for help

+ 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