title: Syntax for combining mid and if functions in excel
body: <p>I am attempting to combine the if and mid functions in excel. If a value in a specific cell is true, then return the first six characters from another cell; otherwise return nothing. The following are the options I have tried:</p>
  
  <ul>
  <li><code>=if(AA2=TRUE), MID(Y2,1,5), "")</code>  </li>
  <li><code>=if(AA2=TRUE), MID(Y2,1,5), ""))</code>  </li>
  <li><code>=if(mid(AA2=True), (Y2, 1, 5), "")</code></li>
  </ul>
  
  <p>Could someone point out the errors in this syntax? I am new to programming and any help would be appreciated. 
  Thanks.</p>