1

In Excel VBA I created the below custom function. Is it possible to replicate that in Excel script?

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
exceldude2001
  • 141
  • 2
  • 2
  • 13
  • what is `Excel script`? Are you talking formula? If so, then the answer is no. – Scott Craner Apr 13 '21 at 21:18
  • TypeScript for excel. is there a way to create custom functions in excel online? – exceldude2001 Apr 14 '21 at 13:25
  • 1
    With Office Scripts you cannot achieve this, you will have to use Office JS and creating a custom function is a little more complicated than you think. https://learn.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-overview – Ethan Apr 14 '21 at 13:35

1 Answers1

2

Currently, you can't create custom functions with Office Scripts. To have this feature request considered in our planning process, you can add the request on our User Voice page.

Thanks - The Office Scripts Team

Petra
  • 356
  • 1
  • 3
  • I guess the share link is not longer available, instead people can use the link to: [Microsoft Feedback](https://feedbackportal.microsoft.com/feedback/) – David Leal May 19 '23 at 02:44