title: Excel formula to get string between 2 characters
body: <p>I'm trying to dynamically extract the string between 2 characters in Excel using a formula (no text to columns). The sample data is:</p>
  
  <pre><code>US - Blue Widgets - Net
  UK - Green - Grass
  UAE - Red - Apples
  </code></pre>
  
  <p>* Note that the data doesn't have fixed length</p>
  
  <p>I tried using a formula, but I think I'm missing something because that also returns the string after the last <code>-</code>.</p>
  
  <p>Formula:</p>
  
  <pre><code>=TRIM(LEFT(SUBSTITUTE(MID(A2,FIND("|",SUBSTITUTE(A2,"-","|",1))+1,LEN(A2)),"_",REPT(" ",LEN(A2))),LEN(A2)))
  </code></pre>
  
  <p>what this returns is:</p>
  
  <pre><code>Blue Widgets - Net
  Green - Grass
  Red - Apples
  </code></pre>
  
  <p>here's what I'd like it to return:</p>
  
  <pre><code>Blue Widgets
  Green
  Red
  </code></pre>