TEXTJOIN function not ignoring blank cells

Copper Contributor

I am trying to concatenate individual parts of an address into a full address field using the TEXTJOIN function.  For example I have Address Number, PreDirection, PreType, StreetName, StreetType, etc and would like them in one field separated by spaces.  Some of those fields may be blank so I want those ignored.  My understanding is that TEXTJOIN is supposed to make that easy.  I would expect that using =TEXTJOIN(" ", TRUE, A2:G2) would accomplish that however I am still getting extra spaces where the empty cells were as seen in the example: 7025    TAYLOR CREEK RD

Any idea why this is happening?  Thanks in advance

!

3 Replies

@lissajo64 

It shall ignore blanks. However, if you have space or other invisible character such value won't be ignored. You may check by =LEN(<cell in question>) if it returns zero.

 

If there cell with spaces you may use

=TEXTJOIN(" ", TRUE, TRIM(A2:G2) )

as array formula

@Sergei Baklan 

I went in and added TRIM and was getting #VALUE! as the result.  I then went into the fields and checked for spaces, replacing with nothing.  It did find spaces in those columns so those were fixed.  I was still getting the #VALUE! error using =TEXTJOIN(" ", TRUE, TRIM(A3:G3))

I guess it didn't like having the TRIM function in there when there was nothing to trim because when I removed that it worked as it should.  Odd to me that the TRIM function would cause an error, I would have thought it would just ignore if it weren't needed. 

Thanks so much for your help! 

@lissajo64 

In general TEXTJOIN itself returns VALUE if only you have quite long string as result, don't remember the limit. If another function is inside usually TEXTJOIN shall be used as array formula, i.e. you shall Ctrl+Shift+Enter it, instead of Enter.

 

Please check attached filed with such formula if it works with you.