ARRAY FORMULA (TEXTJOIN) periodically not updating or returning correct values

JPMAHONY

New Member
Joined
Jul 30, 2015
Messages
4
Hi,

I am using a TEXTJOIN function in an ARRAY FORMULA to return multiple matches to one cell.

However periodically the formula doesnt update and/or doesnt update correctly.

See formula in the attached - cell reference - D63

If you play with the inputs in cells L37:L39 - you will see that periodically they are not updating.

I have multiple sheets (per employee) and need to ensure that formula's are updated automatically.

At the moment, i need to press F2+enter to update

Can you please suggest a solution.

I have basic VBA knowledge.

Any help greatly appreciated.
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Make sure that you have the calculation mode set to automatic...

Code:
Ribbon >> Formulas >> Calculation >> Calculation >> Calculation options >> Automatic
 
Upvote 0
Make sure that you have the calculation mode set to automatic...

Code:
Ribbon >> Formulas >> Calculation >> Calculation >> Calculation options >> Automatic

Hi, calculation is set to automatic and cell format is set to general.
 
Upvote 0
I too have encountered problems with TEXTJOIN not working consistently. I know my formula is correct, because like you, it works when I press F2 and Enter. I've never been able to quantify the problem, it seems to happen more often in some cases than others. I've kind of chalked it up to some kind of subtle situational and/or environmental bug in the TEXTJOIN logic. It is one of the newer functions.

As far as what to do about it, I'm not sure. At one point I wrote up a UDF that mimics the functionality of TEXTJOIN, called TEXTJOINX. If you want to try it, here's the code:

Code:
Function TextJoinX(sep As String, ign As Boolean, ParamArray SubArr() As Variant) As String
Dim i As Long, y As Variant
' Clone of TextJoin for versions of Excel prior to 2016
' 2016, Eric W, adapted from AConcat by Harlan Grove


    Application.Volatile
    TextJoinX = ""
    For i = LBound(SubArr) To UBound(SubArr)
        If TypeOf SubArr(i) Is Range Then
            For Each y In SubArr(i).Cells
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & sep & y.Value
                End If
            Next y
        ElseIf IsArray(SubArr(i)) Then
            For Each y In SubArr(i)
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & sep & y
                End If
            Next y
        Else
            If SubArr(i) = "" And ign Then
            Else
                TextJoinX = TextJoinX & sep & SubArr(i)
            End If
        End If
    Next i
    
    TextJoinX = Mid(TextJoinX, Len(sep) + 1)
        
End Function
Then you'd have to change your formulas to use that instead.
 
Upvote 0
Eric, you sir are a wonderful man.













I too have encountered problems with TEXTJOIN not working consistently. I know my formula is correct, because like you, it works when I press F2 and Enter. I've never been able to quantify the problem, it seems to happen more often in some cases than others. I've kind of chalked it up to some kind of subtle situational and/or environmental bug in the TEXTJOIN logic. It is one of the newer functions.

As far as what to do about it, I'm not sure. At one point I wrote up a UDF that mimics the functionality of TEXTJOIN, called TEXTJOINX. If you want to try it, here's the code:

Code:
Function TextJoinX(sep As String, ign As Boolean, ParamArray SubArr() As Variant) As String
Dim i As Long, y As Variant
' Clone of TextJoin for versions of Excel prior to 2016
' 2016, Eric W, adapted from AConcat by Harlan Grove


    Application.Volatile
    TextJoinX = ""
    For i = LBound(SubArr) To UBound(SubArr)
        If TypeOf SubArr(i) Is Range Then
            For Each y In SubArr(i).Cells
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & sep & y.Value
                End If
            Next y
        ElseIf IsArray(SubArr(i)) Then
            For Each y In SubArr(i)
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & sep & y
                End If
            Next y
        Else
            If SubArr(i) = "" And ign Then
            Else
                TextJoinX = TextJoinX & sep & SubArr(i)
            End If
        End If
    Next i
    
    TextJoinX = Mid(TextJoinX, Len(sep) + 1)
        
End Function
Then you'd have to change your formulas to use that instead.
 
Upvote 0
Old thread here, but it was referenced today so rather than posting in the thread that it was referenced, I decided to post directly here.

@Eric W I have ran a few tests on your TextJoinX (alternative code) and it seems to be excellent! I did however encounter one problem when using it as a direct replacement for 'TextJoin'.

I am sure it has to be something that I did not do correctly because other than one instance, it seems foolproof.

Book1
ABCDEFG
1This is a test of TEXTJOINx.Works !
2
3Check True with Blank CellIn the middleCheck True with Blank Cell In the middleWorks !
4Check False with In the middleCheck False with In the middleWorks!
5
6A3B3A3, B3, A4, B4, A5, B5Works !
7A4B4
8A5B5
9
10JaneErinGordonMs.Ms. Jane Erin GordonWorks !
11
1212/9/202112/16/202112/09/2021 - 12/16/2021Works !
13
14New York CityNY10101US#VALUE!<--- Not Work
15end
16,,,;
17
Sheet3
Cell Formulas
RangeFormula
A1A1=TEXTJOINx(" ",TRUE, "This", "is", "a", "test", "of", "TEXTJOINx.")
D3D3=TEXTJOINx(" ",1,A3:C3)
D4D4=TEXTJOINx(" ",0,A4:C4)
C6C6=TEXTJOINx(", ", 1, A6:B8)
E10E10=TEXTJOINx(" ",1,D10,A10:C10)
C12C12=TEXTJOINx(" - ",1,TEXT(A12,"m/dd/yyyy"),TEXT(B12,"m/dd/yyyy"))
E14E14=TEXTJOINx(A16:D16, TRUE, A14:D15)


The last test listed doesn't seem to work. Did I mess something up?
 
Upvote 0
My UDF clone is only designed to use one delimiter. I wasn't aware that the original TEXTJOIN can use more. I can try to figure something out.
 
Upvote 0
It about doubled the size, and it's VERY lightly tested, but this works on your examples:

VBA Code:
Function TextJoinX(sep As Variant, ign As Boolean, ParamArray SubArr() As Variant) As String
Dim i As Long, y As Variant, c As Long, separr() As String, sc As Long, f1 As Boolean
' Clone of TextJoin for versions of Excel prior to 2016
' 2016, Eric W, adapted from AConcat by Harlan Grove
' 2021, Added multiple separator support

    Application.Volatile
    TextJoinX = ""
    
    If TypeOf sep Is Range Then
        ReDim separr(0 To sep.Cells.Count - 1)
        c = 0
        For Each y In sep
            separr(c) = y.Value
            c = c + 1
        Next y
    ElseIf IsArray(sep) Then
        ReDim separr(0 To UBound(sep) - LBound(sep) + 1)
        c = 0
        For Each y In sep
            separr(c) = y
            c = c + 1
        Next y
    Else
        ReDim separr(0 To 0)
        separr(0) = sep
    End If
    c = 0
    sc = UBound(separr) + 1
    f1 = False
    
    For i = LBound(SubArr) To UBound(SubArr)
        If TypeOf SubArr(i) Is Range Then
            For Each y In SubArr(i).Cells
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & IIf(f1, separr(c Mod sc), "") & y.Value
                    c = IIf(f1, c + 1, c)
                    f1 = True
                End If
            Next y
        ElseIf IsArray(SubArr(i)) Then
            For Each y In SubArr(i)
                If y = "" And ign Then
                Else
                    TextJoinX = TextJoinX & IIf(f1, separr(c Mod sc), "") & y
                    c = IIf(f1, c + 1, c)
                    f1 = True
                End If
            Next y
        Else
            If SubArr(i) = "" And ign Then
            Else
                TextJoinX = TextJoinX & IIf(f1, separr(c Mod sc), "") & SubArr(i)
                c = IIf(f1, c + 1, c)
                f1 = True
            End If
        End If
    Next i
        
End Function
 
Upvote 0
It about doubled the size, and it's VERY lightly tested, but this works on your examples:

I'm sorry. :(

I did run some more tests today with your new/improved code version.

Today, I only found two more examples, the last two examples, that do not seem to yield the proper response. I can't test the actual 'TextJoin' function to compare, I only have posted online results to compare to. :(

TextJoinAlternative.xlsm
ABCDEFG
1This is a test of TEXTJOINx.Works !
2
3Check True with Blank CellIn the middleCheck True with Blank Cell In the middleWorks !
4Check False with In the middleCheck False with In the middleWorks!
5
6A6B6A6, B6, A7, B7Works !
7A7B7
8
9JaneErinGordonMs.Ms. Jane Erin GordonWorks !
10
1112/9/202112/16/202112/09/2021 - 12/16/2021Works !
12
13New York CityNY10101USNew York City,NY,10101,US;endWorks !
14end
15,,,;
16
17John2Team 1Jim, BobWorks !
18Jim1Team 2John, BillWorks !
19Bob1
20Bill2
21
22JimPensBobChalk, CrayonsWorks !
23JimPencilsJimPens, Pencils, PaperWorks !
24BobChalk
25JimPaper
26BobCrayons
27
28MonkeyyeknoMWorks !
29
30A30B30A30-- A31-- B30-- B31Works !
31A31B31
32
33New York CityNYNew York City NY<--- works when cell is set to wrap textWorks !
34
35, TRUERedBlackRed, Green, Blue, Black, WhiteWorks !
36GreenWhite
37Blue
38
39USNew York CityNY10101US, New York CityNY, 10101? Not Sure, 2 commas?
40
41123#VALUE!<--- should be 123Not Work
42
Sheet3
Cell Formulas
RangeFormula
A1A1=TextJoinx(" ",TRUE, "This", "is", "a", "test", "of", "TEXTJOINx.")
D3D3=TextJoinx(" ",1,A3:C3)
D4D4=TextJoinx(" ",0,A4:C4)
C6C6=TextJoinx(", ", 1, A6:B7)
E9E9=TextJoinx(" ",1,D9,A9:C9)
C11C11=TextJoinx(" - ",1,TEXT(A11,"m/dd/yyyy"),TEXT(B11,"m/dd/yyyy"))
E13E13=TextJoinx(A15:D15, TRUE, A13:D14)
D17D17=TextJoinx(", ", TRUE, IF($B$17:$B$20=1, $A$17:$A$20, ""))
D18D18=TextJoinx(", ", TRUE, IF($B$17:$B$20=2, $A$17:$A$20, ""))
D22:D23D22=TextJoinx(", ", TRUE, IF($A$22:$A$26=C22, $B$22:$B$26, ""))
B28B28=TextJoinx("",1,MID(A28,{10,9,8,7,6,5,4,3,2,1},1))
C30C30=TextJoinx("-- ", 1, A30:A31,B30:B31)
C33C33=TextJoinx(CHAR(10), TRUE, A33:B33)
E35E35=TextJoinx(A35,B35,C35:C37,D35:D37)
E39E39=TextJoinx({", "}, TRUE, A39:D39)
D41D41=TextJoinx(,TRUE,A41:C41)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top