title: How to pass an array of results in a User defined Function in Excel-VBA?
body: <p>I'm checking to see if there is any way to pass an array of results in an UDF. </p>
  
  <p>My function is working as expected if I pass a range, for eg - <code>$A$2:$A$5</code>, but not if I make array calculations before passing the range, for eg -  <code>IF($A$2:$A$5 &lt; 3, $A$2:$A$5 ,"")</code> with control + shift + enter.</p>
  
  <p><a href="https://i.stack.imgur.com/ZHmRT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHmRT.png" alt="enter image description here"></a></p>
  
  <p>Here's the code I'm using-</p>
  
  <pre><code>Public Function ReverseTextToColumns(Rg As Range, Optional D As String = " ") As String
    Dim xArr
    xArr = Application.WorksheetFunction.Transpose((Rg.Value))
    ReverseTextToColumns = Join(xArr, D)
  End Function
  </code></pre>
  
  <p>I don't want to create a complicated function and just to know how to pass an array of results in an UDF.</p>