title: custom function in office script?
body: <p>In Excel VBA I created the below custom function.  Is it possible to replicate that in Excel script?</p>
  <pre><code>Function ColorSum(myrange As Range, mycolorindex As Integer) As Double
      Dim c As Range
      On Error Resume Next
      For Each c In myrange.Cells
          If c.Interior.ColorIndex = mycolorindex Then _
            ColorSum = ColorSum + c.Value
      Next
  End Function
  </code></pre>