Home

TEXTJOIN function not ignoring blank cells

%3CLINGO-SUB%20id%3D%22lingo-sub-849620%22%20slang%3D%22en-US%22%3ETEXTJOIN%20function%20not%20ignoring%20blank%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-849620%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20concatenate%20individual%20parts%20of%20an%20address%20into%20a%20full%20address%20field%20using%20the%20TEXTJOIN%20function.%26nbsp%3B%20For%20example%20I%20have%20Address%20Number%2C%20PreDirection%2C%20PreType%2C%20StreetName%2C%20StreetType%2C%20etc%20and%20would%20like%20them%20in%20one%20field%20separated%20by%20spaces.%26nbsp%3B%20Some%20of%20those%20fields%20may%20be%20blank%20so%20I%20want%20those%20ignored.%26nbsp%3B%20My%20understanding%20is%20that%20TEXTJOIN%20is%20supposed%20to%20make%20that%20easy.%26nbsp%3B%20I%20would%20expect%20that%20using%26nbsp%3B%3DTEXTJOIN(%22%20%22%2C%20TRUE%2C%20A2%3AG2)%20would%20accomplish%20that%20however%20I%20am%20still%20getting%20extra%20spaces%20where%20the%20empty%20cells%20were%20as%20seen%20in%20the%20example%3A%207025%26nbsp%3B%20%26nbsp%3B%20TAYLOR%20CREEK%20RD%3C%2FP%3E%3CP%3EAny%20idea%20why%20this%20is%20happening%3F%26nbsp%3B%20Thanks%20in%20advance%3CBR%20%2F%3E%3CBR%20%2F%3E!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-849620%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETEXTJOIN%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-849860%22%20slang%3D%22en-US%22%3ERe%3A%20TEXTJOIN%20function%20not%20ignoring%20blank%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-849860%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F407501%22%20target%3D%22_blank%22%3E%40lissajo64%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20shall%20ignore%20blanks.%20However%2C%20if%20you%20have%20space%20or%20other%20invisible%20character%20such%20value%20won't%20be%20ignored.%20You%20may%20check%20by%20%3DLEN(%3CCELL%20in%3D%22%22%20question%3D%22%22%3E)%20if%20it%20returns%20zero.%3C%2FCELL%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20there%20cell%20with%20spaces%20you%20may%20use%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DTEXTJOIN(%22%20%22%2C%20TRUE%2C%20TRIM(A2%3AG2)%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eas%20array%20formula%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-851649%22%20slang%3D%22en-US%22%3ERe%3A%20TEXTJOIN%20function%20not%20ignoring%20blank%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-851649%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20went%20in%20and%20added%20TRIM%20and%20was%20getting%20%23VALUE!%20as%20the%20result.%26nbsp%3B%20I%20then%20went%20into%20the%20fields%20and%20checked%20for%20spaces%2C%20replacing%20with%20nothing.%26nbsp%3B%20It%20did%20find%20spaces%20in%20those%20columns%20so%20those%20were%20fixed.%26nbsp%3B%20I%20was%20still%20getting%20the%20%23VALUE!%20error%20using%3CSPAN%3E%3CEM%3E%26nbsp%3B%3DTEXTJOIN(%22%20%22%2C%20TRUE%2C%20TRIM(A3%3AG3))%3C%2FEM%3E.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20guess%20it%20didn't%20like%20having%20the%20TRIM%20function%20in%20there%20when%20there%20was%20nothing%20to%20trim%20because%20when%20I%20removed%20that%20it%20worked%20as%20it%20should.%26nbsp%3B%20Odd%20to%20me%20that%20the%20TRIM%20function%20would%20cause%20an%20error%2C%20I%20would%20have%20thought%20it%20would%20just%20ignore%20if%20it%20weren't%20needed.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%20so%20much%20for%20your%20help!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-852063%22%20slang%3D%22en-US%22%3ERe%3A%20TEXTJOIN%20function%20not%20ignoring%20blank%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-852063%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F407501%22%20target%3D%22_blank%22%3E%40lissajo64%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20general%20TEXTJOIN%20itself%20returns%20VALUE%20if%20only%20you%20have%20quite%20long%20string%20as%20result%2C%20don't%20remember%20the%20limit.%20If%20another%20function%20is%20inside%20usually%20TEXTJOIN%20shall%20be%20used%20as%20array%20formula%2C%20i.e.%20you%20shall%20Ctrl%2BShift%2BEnter%20it%2C%20instead%20of%20Enter.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20check%20attached%20filed%20with%20such%20formula%20if%20it%20works%20with%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E
lissajo64
New 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.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies