title: Concatenate Values from a Range based on a Lookup
body: <p>I'm working on a budget for a project with multiple phases. There is a possibility that not all phases will be worked on so I've added some lookups and SUMIF formulas so that I can get a summary of my included and excluded effort and dollar amounts. That all works fine. Now I'd like to hide my row of lookups (row 1), but still have a way of identifying which phases of the project are included and which are excluded. Obviously I could manually concatenate them together, but if the phases being included/excluded change then I need to remember to update those formulas (and it's not nearly as fun as doing all in a formula). Here's how my sheet looks:</p>
  
  <p><a href="https://i.stack.imgur.com/sQ37k.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sQ37k.jpg" alt="Table Layout"></a>
  The TEXTJOIN function seems like it should work (i.e. <code>=TEXTJOIN(CHAR(10), TRUE, C2:N2)</code>), but I can't wrap my head around how to make the range parameter dependent on my lookup row. I played around with INDEX using something like <code>=TEXTJOIN(CHAR(10), TRUE, INDEX(A2:M2,,(A1:M1="Yes")*COLUMN(A1:M1)))</code>, but didn't have any luck. At the end of the day I want to have something like:<br></p>
  
  <blockquote>
    <p>Phase 1<br>   Phase 2<br>   Phase 5</p>
  </blockquote>
  
  <p>Please note that the above data should all appear in the same cell - using the line feed character, CHAR(10), as the delimiter in the TEXTJOIN function will make all of the phases appear on a new line within a single cell. I do not want to fill formulas through multiple cells. Thanks in advance for any help.</p>