title: How to extract text before special character from string in Excel?
body: <p>I have below text on column A1:</p>
  
  <blockquote>
    <p>100-This_Is_My-Test_200</p>
  </blockquote>
  
  <p>Looking to get output as below in column B1:</p>
  
  <blockquote>
    <p><strong>100-This_Is_My-Test</strong></p>
  </blockquote>
  
  <p>so basically it needs to remove text starting from last _ (underscore) </p>
  
  <p>I tried below:</p>
  
  <pre><code>=TRIM(RIGHT(SUBSTITUTE(A1,"_",REPT(" ",LEN(A1))),LEN(A1)))  
  </code></pre>
  
  <p>Output: <strong>200</strong></p>
  
  <pre><code>=TRIM(LEFT(SUBSTITUTE(A1,"_",REPT(" ",LEN(A1))),LEN(A1)))  
  </code></pre>
  
  <p>Output: <strong>100-This</strong></p>