excel - Concatenate a column of data (ignoring blanks) and separating data with line break -
looking concatenate data in column column c shown in attached image. (note: column c hard-coded)
any appreciated, thanks.
use textjoin()
=textjoin(char(10),true,a1:a6) text join introduced office 365 excel. if not have put code in module attached workbook , use formula described above:
function textjoin(delim string, skipblank boolean, arr)     dim d long     dim c long     dim arr2()     dim t long, y long     t = -1     y = -1     if typename(arr) = "range"         arr2 = arr.value     else         arr2 = arr     end if     on error resume next     t = ubound(arr2, 2)     y = ubound(arr2, 1)     on error goto 0      if t >= 0 , y >= 0         c = lbound(arr2, 1) ubound(arr2, 1)             d = lbound(arr2, 1) ubound(arr2, 2)                 if arr2(c, d) <> "" or not skipblank                     textjoin = textjoin & arr2(c, d) & delim                 end if             next d         next c     else         c = lbound(arr2) ubound(arr2)             if arr2(c) <> "" or not skipblank                 textjoin = textjoin & arr2(c) & delim             end if         next c     end if     textjoin = left(textjoin, len(textjoin) - len(delim)) end function 
Comments
Post a Comment