title: How do I pass multiple columns into a formula in Google Spreadsheets?
body: <p>I'm creating a new spreadsheet for daytrading, where I want to automate the calculations for every row. I have already looked at Google's custom function guide which deals with only one column. I have multiple columns whose values need to be taken into account. For example, I want:</p>
  
  <blockquote>
    <p>Column D1:D = (Column A1:A x Column B:B) - (Column C1:C)</p>
  </blockquote>
  
  <p>How do I do this using custom functions only since they are cleaner and more easier to read (I have gotten this to work without using a custom formula and the solution is not readable, maintainable, or elegant)?</p>
  
  <p>Edit: I'm familiar with this recursive formula from Google's guide on custom formulas but I don't know how to modify it for multiple columns:</p>
  
  <pre><code>function DOUBLE(input) {  
    if(input.map) {
      return input.map(DOUBLE);
    } else {
      return input * 2;
    }
  }
  </code></pre>