Skip to content →

Excel equivalent of the PHP Implode function

Share on FacebookShare on Google+Tweet about this on TwitterShare on VKShare on TumblrPin on Pinterest

Извините, этот техт доступен только в English.

To add this code you need to do the following:

  • Open your work book
  • Press ALT + F11 and the code window should appear
  • Right click on VBA project and choose INSERT then MODULE
  • Copy paste the following code:
Function IMPLODE(Rng As Range, Sep As String)
    Dim TEMP As String
    For Each Cell In Rng
      If Cell.Value = "" Then
      Else
        TEMP = TEMP & Cell.Value & Sep
      End If
    Next Cell
    TEMP = Left(TEMP, Len(TEMP) - Len(Sep))
    IMPLODE = TEMP
End Function

Now in your worksheet go to the cell you want the combined field to be added to and type

=IMPLODE(A1:A3, «,»);

Original link http://www.alunr.com/articles/excel-vba-equivalent-of-the-php-implode-function

Share on FacebookShare on Google+Tweet about this on TwitterShare on VKShare on TumblrPin on Pinterest

Published in IT