+ Reply to Thread
Results 1 to 3 of 3

Return corresponding values for cells in a range not empty

  1. #1
    Registered User
    Join Date
    07-14-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac 2011
    Posts
    14

    Return corresponding values for cells in a range not empty

    Hello,

    I'd like to create a formula that checks a range to find nonblank cells and then returns values from cells that correspond to those nonblanks that were found. I want all the returned values to be aggregated in a single cell separated by commas.

    See Column B in the attachment for an example of how I'd like the formula to work.

    Thanks!
    Erin
    Attached Files Attached Files

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

    Re: Return corresponding values for cells in a range not empty

    You can put this in B2:

    =SUBSTITUTE(SUBSTITUTE(IF(C2="","",C$1&", ") & IF(D2="","",D$1&", ") & IF(E2="","",E$1&", ") & IF(F2="","",F$1&", ") & IF(G2="","",G$1&", ") & "xx",", xx",""),"xx","")

    then copy down.

    Hope this helps.

    Pete

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Return corresponding values for cells in a range not empty

    There is no a perfect way of concatenating text strings with a formula unless you are a subscriber of Office 365 which offers a great excel function TEXTJOIN.
    However, there is a good news! You can get the same functionality with a VBA version.
    Here is how to do this:

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    Don't forget to save your worbook as Macro-Enabled workbook.

    http://www.get-digital-help.com/2016...tjoin-function

    Please Login or Register  to view this content.
    Then enter array formula in a cell B2 and copy formula down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ***Array formula
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.
    You will know the array is active when you see curly braces { } appear around your formula.
    If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ 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. Replies: 4
    Last Post: 10-01-2015, 11:01 AM
  2. Return Unique Values from range Selection.Cells
    By xerksis in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-27-2015, 07:53 AM
  3. Replies: 7
    Last Post: 06-12-2014, 05:00 AM
  4. Replies: 1
    Last Post: 10-22-2013, 05:15 PM
  5. Replies: 2
    Last Post: 11-12-2012, 06:26 AM
  6. Replies: 1
    Last Post: 08-16-2012, 12:59 PM
  7. [SOLVED] find unique values in a range that contains text and empty cells
    By bombicci in forum Excel General
    Replies: 4
    Last Post: 07-04-2012, 09:17 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