Can a custom VBA function know that the formula is being entered as an array formula?
Is it possible for the following function to return either multiple values ββor a single value according to how the user enters the formula?
Public Function Test(ByVal flNumber As Double) As Variant
Dim flResult1 As Double
Dim sResult2 As String
Dim bArrayFormula As Boolean
flResult1 = Round(flNumber / 10 ^ 6, 1)
sResult2 = "million"
' How to know that the formula is entered as an array formula?
If bArrayFormula Then
Test = Array(flResult1, sResult2)
Else
Test = flResult1 & " " & sResult2
End If
End Function
+3
source to share