title: How to replicate Excel's TEXTJOIN function in VBA UDF that allows array inputs
body: <p>If I have different values in different cells, how can I join them together with a function with a delimiter of my own choosing (like "," or "| ", etc.).</p>
  
  <p>For example:</p>
  
  <p>So if you have:</p>
  
  <pre><code>A1: foo
  A2: bar
  A3: baz
  </code></pre>
  
  <p>You can type in A4:</p>
  
  <pre><code>=somefunction("",A1:A3)
  </code></pre>
  
  <p>And you will get in A4: </p>
  
  <pre><code>foo bar baz
  </code></pre>
  
  <p>Moreover, what if the inputs are results of an array function, like:
  {foo, bar, bar}</p>
  
  <p>Maybe a UDF would work?</p>
  
  <p>I know in Microsoft Office 2016 there is the textjoin function, but it is only available for Office 365 subscribers. And this function cannot handle array inputs.</p>