+ Reply to Thread
Results 1 to 3 of 3

Concatenate cell values based on condition

  1. #1
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    51

    Concatenate cell values based on condition

    Hi,

    I need to concatenate values of cells from another sheet based on a certain condition.

    I found on this forum the following macro:
    Please Login or Register  to view this content.
    so I set up in the centralizing sheet this formula that on drag down can concatenate values from different sheets:

    =Conc(INDIRECT("'"&ROW()-2&"'!$A$"&MATCH("Key Word";INDIRECT("'"&MAX(ROW()-2)&"'!$A$1:$A$200");0)+1):INDIRECT("'"&ROW()-2&"'!$A$130");", ")

    I use ROW()-2 to target the sheet so that by dragging the formula down it will get data from the next sheet (formula is placed on row 3).
    I use MATCH to get the starting value of the Range from witch the values will be concatenated (starting position may be different from sheet to sheet).

    What I don't know how to do, is to concatenate only the values that have in an adjoining cell (2nd cell from value to be concatenated) a certain value.

    I attached a sample document, that better explains what I need to do.

    sample.xlsm

    I would appreciate any help.

    Thank you

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Concatenate cell values based on condition

    Hi Alexandruc,

    Adjust your code slightly to:
    Please Login or Register  to view this content.
    And then use this updated formula (change in red):

    =Conc(INDIRECT("'"&ROW()-2&"'!$A$"&MATCH("key word",INDIRECT("'"&MAX(ROW()-2)&"'!$A$1:$A$200"),0)+1):INDIRECT("'"&ROW()-2&"'!$A$130"),"get",", ")

    I changed your variable "cell" to "ce". Just one of those coding things - try not to reference actual objects even though a cell is considered a range variable. Just my 2 cents.

  3. #3
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Concatenate cell values based on condition

    Just beautiful! Thank you very much Paul!

+ 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