title: String manipulation with Excel - how to remove part of a string if another part is there?
body: <p>I've done some Googling, and can't find anything, though maybe I'm just looking in the wrong places. I'm also not very adept at VBA, but I'm sure I can figure it out with the right pointers :)</p>
  
  <p>I have a string I'm building that's a concatenation of various cells, based on various conditions. I hit these in order.</p>
  
  <pre><code>=IF(A405&lt;&gt;A404,G405,G405&amp;H404)
  </code></pre>
  
  <p>What I want to do is go back through my concatenated list, removing a superseded value if the superseder is in the list.</p>
  
  <p>For example, see the following list:</p>
  
  <pre><code>A, D, G, Y, Z
  </code></pre>
  
  <p>I want to remove <code>D</code> <em>if</em> and <strong>only</strong> <em>if</em> <code>Y</code> is present.</p>
  
  <p>How would I go about this? (VBA or in-cell, though I'd prefer in-cell)</p>