CharlieNVA
New Member
- Joined
- Feb 16, 2015
- Messages
- 11
I have seen recommendations to write user defined functions to replace TEXTJOIN
I have tried Confusion Of Join Method written by Sulprobil which works for simple ranges but fails when the input parameters are formulas.
Function TEXTJOIN(Delimiter As String, _
Ignore_empty As Boolean, _
ParamArray Text() As Variant) As String
Dim v, i As Long, s As String
For i = LBound(Text) To UBound(Text)
For Each v In Text(i)
If Not (Ignore_empty And v = "") Then
TEXTJOIN = TEXTJOIN & s & v
s = Delimiter
End If
Next v
Next i
End Function
=TEXTJOIN("|", TRUE, $A5, $C5:$H5,TEXT($I5,"mm/dd/yyyy"),IF(ISBLANK($J5),"",TEXT($J5,"mm/dd/yyyy") )
where A5, c5:h5 are text and I5 and j5 are date fields
It can't seem to handle the TEXT($I5,"mm/dd/yyyy") or if formulas.
Has anyone seen some sample code that can handle this?
I am porting someone else's code from an office 365 environment to office 2106. Note the sample I provided is simplified. The actual formula joins more than 100 columns that repeat the if(isblanks ... pattern.
I have tried Confusion Of Join Method written by Sulprobil which works for simple ranges but fails when the input parameters are formulas.
Function TEXTJOIN(Delimiter As String, _
Ignore_empty As Boolean, _
ParamArray Text() As Variant) As String
Dim v, i As Long, s As String
For i = LBound(Text) To UBound(Text)
For Each v In Text(i)
If Not (Ignore_empty And v = "") Then
TEXTJOIN = TEXTJOIN & s & v
s = Delimiter
End If
Next v
Next i
End Function
=TEXTJOIN("|", TRUE, $A5, $C5:$H5,TEXT($I5,"mm/dd/yyyy"),IF(ISBLANK($J5),"",TEXT($J5,"mm/dd/yyyy") )
where A5, c5:h5 are text and I5 and j5 are date fields
It can't seem to handle the TEXT($I5,"mm/dd/yyyy") or if formulas.
Has anyone seen some sample code that can handle this?
I am porting someone else's code from an office 365 environment to office 2106. Note the sample I provided is simplified. The actual formula joins more than 100 columns that repeat the if(isblanks ... pattern.