Issues with Excel Textjoin, need a work around
I am trying to figure out how to setup a couple excel sheets that combs through ALOT of information. I can not display the actual excel sheet due to what's in it but I have recreated an excel that would do the same thing.
I am trying to get the dates to populate automatically when the CountIF finds something... Say, Blake shows up multiple times in the data range I need it to look through, I need all the dates or at least the most recent date to populate on its own in 1 cell next to the CountIf number or in the same cell as the CountIf.
The cell should display 06/22/2022, 06/29/2022
.
I am using Excel 2016, I do not have a built in TEXTJOIN.
@scott, Thank you for responding, I added your TEXTJOIN UDF and I am getting a #VALUE! message in the cell. I tried with a cell that would return 1 date, no date, and multiple dates. The date format in the excel I can not show is 20220623, so I am not sure if that matters or not. I got it to work on the test excel sheet I made for the screen shot just not the one I need it to work on. The only difference is, the sheet im calling the data from is using -'s, numbers and letters in the cell, and the location I am calling the info to pop up on is on a different sheet so the formula looks like
=TEXTJOIN(",",TRUE,IF('SHEET2!E:E="example-A-1",'SHEET2!A:A,""))
Using this UDF
Function TEXTJOIN(delim As String, skipblank As Boolean, arr)
Dim d As Long
Dim c As Long
Dim arr2()
Dim t As Long, y As Long
t = -1
y = -1
If TypeName(arr) = "Range" Then
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 And y >= 0 Then
For c = LBound(arr2, 1) To UBound(arr2, 1)
For d = LBound(arr2, 1) To UBound(arr2, 2)
If arr2(c, d) <> "" Or Not skipblank Then
TEXTJOIN = TEXTJOIN & arr2(c, d) & delim
End If
Next d
Next c
Else
For c = LBound(arr2) To UBound(arr2)
If arr2(c) <> "" Or Not skipblank Then
TEXTJOIN = TEXTJOIN & arr2(c) & delim
End If
Next c
End If
TEXTJOIN = Left(TEXTJOIN, Len(TEXTJOIN) - Len(delim))
End Function
Comments
Post a Comment