title: Add title row with ARRAYFORMULA in Google Sheets
body: <p>I watched a <a href="https://youtu.be/o_ZyEYZaFJs?t=7m54s" rel="nofollow noreferrer">tutorial</a> where the author uses an <a href="https://support.google.com/docs/answer/3093364?hl=en" rel="nofollow noreferrer">IF statement</a> along with the <a href="https://support.google.com/docs/answer/3093275?hl=en" rel="nofollow noreferrer">ARRAYFORMULA function</a> to add a title row to a column of data. Links are given to the docs; however, for an example of how to use <code>ARRAYFORMULA</code> see this <a href="https://stackoverflow.com/a/19040771/2909897">answer</a>.</p>
  
  <p>An example can be seen below:</p>
  
  <p><a href="https://i.stack.imgur.com/WjEvL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjEvL.png" alt="enter image description here"></a></p>
  
  <p>I was able to populate the <code>C</code> column by placing the following formula in <code>C1</code>:</p>
  
  <pre><code>=ARRAYFORMULA(if(row(A:A) = 1, "spent", B:B - A:A))
  </code></pre>
  
  <p>I'm confused about the syntax. I understand that <code>X:X</code> references the entire <code>X</code> column but I don't understand how it's being used to check if we're at cell <code>A1</code> in one context and then being used to apply mass formulas in another context.</p>
  
  <ul>
  <li>How does the above line work?</li>
  <li>Can you illustrate with some examples?</li>
  </ul>