+ Reply to Thread
Results 1 to 6 of 6

Conditionally Concatenate and format multiple cells into one

  1. #1
    Registered User
    Join Date
    03-27-2019
    Location
    Dallas, Texas
    MS-Off Ver
    2016
    Posts
    15

    Conditionally Concatenate and format multiple cells into one

    Hello, I have attached a formula sheet that makes this easier to explain. Essentially I have about 100 columns. Which may or may not be populated. If they are populated I need to pull the value into a single cell in the format "Column_Name_1: Column_Value_1, Column_Name_2: Column_Value_2, Column_Name_3: Column_Value_3 etc etc while skipping over the blanks. I have tried to use an array function with textjoin but it did not work. Any help would be appreciated
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Conditionally Concatenate and format multiple cells into one

    If you put the following in G2, it'll give you the result you want for these limited columns
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    But you're going to end up with one hell of a formula for 100+ rows.

    It might be best to use a UDF, instead:
    Please Login or Register  to view this content.
    Put the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in the last cell in the row - if you want it elsewhere, that's fine but you'll have to take away the "-1" (minus 1) from the LCol.

    Remember, also, that UDFs only update when they're forced to recalculate.

    Does that get you started?

    Tim


    EDITED to correct circular reference problem.
    Attached Files Attached Files
    Last edited by harrisonland; 05-18-2020 at 06:09 PM.
    Never stop learning!
    <--- please consider *-ing !

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Conditionally Concatenate and format multiple cells into one

    The non-array TEXTJOIN formula for F2, then copied down, would be:

    =TEXTJOIN(",",TRUE, IF(B2:E2<>"","["&$B$1:$E$1&"]=["&B2:E2&"]",""))

    But I don't understand fully why you have "blanks" in your G4 and G6 output. Whatever reasonings, you can probably add them to the beginning of the formula above as IF prechecks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Conditionally Concatenate and format multiple cells into one

    Quote Originally Posted by JBeaucaire View Post
    =TEXTJOIN(",",TRUE, IF(B2:E2<>"","["&$B$1:$E$1&"]=["&B2:E2&"]",""))
    Nice. So much better, thanks - I've learned something again today.

    Tim


    NB that's an array formula, right?

  5. #5
    Registered User
    Join Date
    03-27-2019
    Location
    Dallas, Texas
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditionally Concatenate and format multiple cells into one

    This was super helpful and solved the problem perfectly!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Conditionally Concatenate and format multiple cells into one

    It is an array function, but it is not entered with CTRL+SHIFT+ENTER, it is not necessary. TEXTJOIN handles the array functionality by design.

+ 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. [SOLVED] Conditionally Format Cells that are different
    By kersplash in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-07-2018, 04:23 AM
  2. Replies: 1
    Last Post: 01-20-2016, 08:56 AM
  3. Replies: 1
    Last Post: 03-15-2013, 06:46 AM
  4. Replies: 3
    Last Post: 01-10-2012, 06:05 PM
  5. Conditionally Format Row based on Multiple Cells in Row
    By todd.debacker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2007, 03:56 AM
  6. [SOLVED] how do i concatenate conditionally formatted cells in excel
    By Sandwiches2 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-13-2006, 09:45 PM
  7. [SOLVED] conditionally format cells
    By elad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-13-2005, 01:06 PM

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