title: IF function to identify first character of cell
body: <p>I'm trying to use the IF function in Excel so that if the first character of a cell is <code>9</code>, then the value shown should be the eight rightmost characters of that cell, otherwise the value shown should be the four rightmost characters. This formula however does not work:</p>
  
  <pre><code>=IF(LEFT(A2,1)=9,RIGHT(A2,8),RIGHT(A2,4))
  </code></pre>
  
  <p>It keeps returning the rightmost four numbers even though the number in cell A2 starts with <code>9</code>.  </p>
  
  <p>Could you please point out what I'm doing wrong here?</p>