My solution is to use variant as parameter. It can be array and Range.
Test if it is a single cell/value, it will be not converted to array. In this case return the value of the cell.
Test if it is Range object. If it is the case convert it to array. Array is quick.
For summing I would loop through the array with for each to avoid any complication of indexing in the array. (One or two dimensional).
Additionally the values shall be tested if they are numbers.
The small sub is for testing the function call from a sub.
Function foo(x As Variant) As Double
If VarType(x) < vbArray Then 'Single element
foo = IIf(IsNumeric(x), x, 0) ' if x is number return x else 0
Exit Function
End If
If TypeName(x) = "Range" Then x = x.Value2 ' if Range converts to array
Dim v As Variant
' sum all values of x
For Each v In x
'sum only numbers, ignor anything else
If IsNumeric(v) Then foo = foo + v
Next v
End Function
Sub testFoo()
'Test for non Range
Debug.Print foo(Array(1, 34, 5)) 'Test for array
Debug.Print foo(5.2) ' Test for a number
Debug.Print foo("Apple") ' Test for not number
End Sub
Results:
40; 5,2; 0