SOLVED
Home

Array formula returning #VALUE when using large text-based field

%3CLINGO-SUB%20id%3D%22lingo-sub-644932%22%20slang%3D%22en-US%22%3EArray%20formula%20returning%20%23VALUE%20when%20using%20large%20text-based%20field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-644932%22%20slang%3D%22en-US%22%3E%3CP%3EWorking%20on%20a%20report%20for%20a%20customer.%26nbsp%3B%20Basic%20issue%20is%20data%20coming%20through%20on%20multiple%20rows%20and%20customer%20wants%20consolidated%20on%20one%20row.%26nbsp%3B%20My%20reporting%20tool%20doesn't%20allow%20me%20to%20consolidate%20to%20one%20row%20as%20their%20query%20requires.%26nbsp%3B%20Couple%20of%20approaches%2C%20one%20using%20pivot%2C%20one%20using%20arrays%20INDEX%2FMATCH%2FTEXTJOIN.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20have%20a%20set%20of%20data%20on%20one%20sheet%20in%20a%20table.%26nbsp%3B%20It's%20not%20huge%20(%26lt%3B1000%20rows).%26nbsp%3B%20On%20the%20other%2C%20I've%20identified%20the%20unique%20reference%20numbers%20and%20placed%20in%20column%20A.%26nbsp%3B%20I%20then%20go%20across%20and%20do%20simpler%20INDEX%2FMATCHes%20to%20get%20the%20data%20in%20columns%20where%20it%20is%20the%20same%20on%20all%20rows.%26nbsp%3B%20For%20the%20columns%20where%20I%20need%20to%20consolidate%20the%201%2B%20rows%2C%20I%20use%20the%20TEXTJOIN.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3DTEXTJOIN(%22--%22%2CTRUE%2CIF(%5B%40%5BAssignment%20ID%5D%5D%3DAdhocTable%5BAssignment%20ID%5D%2CIF(AdhocTable%5BImmigration%20Status%20Update.Comments%5D%3D0%2C%22%22%2CAdhocTable%5BImmigration%20Status%20Update.Comments%5D)%2C%22%22))%7D%3C%2FP%3E%3CP%3EIt's%20actually%20working%20great%2C%20except%20for%20a%20few%20rows.%26nbsp%3B%20The%20.Comments%20field%20is%20free%20form%20text%20and%20can%20be%20long.%26nbsp%3B%20The%20longest%20successfully%20working%20is%20254.%26nbsp%3B%20Some%20go%20up%20to%201500%20in%20LEN.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20see%20the%20%23VALUE%20in%20the%20array%20when%20I%20evaluate%20the%20formula%20for%20one%20with%20a%20long%20text%20field.%26nbsp%3B%20Am%20I%20running%20up%20against%20some%20limitation%20for%20arrays%20when%20using%20text%20fields%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPivot%20works%2C%20okay.%26nbsp%3B%20But%20it's%20not%20quite%20as%20attractive.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-644932%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-645942%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20formula%20returning%20%23VALUE%20when%20using%20large%20text-based%20field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-645942%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F346770%22%20target%3D%22_blank%22%3E%40joerames%3C%2FA%3E%26nbsp%3B%2C%20great%20finding%2C%20I%20didn't%20know%20about%20that.%20Yes%2C%20it%20looks%20like%20conditional%20functions%20as%20IF()%20return%20max%20255%20characters%20length%20text%20as%20an%20array%20element.%3C%2FP%3E%0A%3CP%3EI%20played%20with%20simple%20model%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20567px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F116022i258E1F7B3D8C8E7C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ethe%20workaround%20could%20be%3C%2FP%3E%0A%3CPRE%3E%3DTEXTJOIN(%22--%22%2CTRUE%2CLEFT(%24C%243%3A%24C%245%2CIF(%24D%243%3A%24D%245%3D%22a%22%2CLEN(%24C%243%3A%24C%245)%2C0)))%3C%2FPRE%3E%0A%3CP%3E(CSE%20formula).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETEXTJOIN%20itself%20returns%20%23VALUE%20if%20the%20resulting%20string%20is%20more%20than%2032K%20length%2C%20don't%20remember%20exactly.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-688964%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20formula%20returning%20%23VALUE%20when%20using%20large%20text-based%20field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-688964%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%3BSorry%20for%20the%20slow%20reply.%26nbsp%3B%20I%20haven't%20quite%20figured%20out%20how%20to%20use%20your%20advice.%26nbsp%3B%20I've%20attached%20a%20sample%20file.%26nbsp%3B%20I%20messed%20with%20it%20quite%20a%20bit.%26nbsp%3B%20Not%20an%20expert%20here.%3C%2FP%3E%3CP%3EThe%20file%20has%203%20cases.%26nbsp%3B%20One%20is%20working.%26nbsp%3B%20One%20doesn't%20error%2C%20but%20returns%200's%20and%20I%20don't%20want%20that.%26nbsp%3B%20The%20final%20case%20shows%20the%20long%20field%20and%20it%20%23ing%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWould%20love%20for%20you%20to%20take%20a%20peak%20and%20help%20me%20along!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-692016%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20formula%20returning%20%23VALUE%20when%20using%20large%20text-based%20field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692016%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F346770%22%20target%3D%22_blank%22%3E%40joerames%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20formula%20could%20be%3C%2FP%3E%0A%3CPRE%3E%3DTEXTJOIN(CHAR(10)%2CTRUE%2CLEFT(AdhocTable%5BImmigration%20Status%20Update.Comments%5D%2CIF(%5B%40%5BAssignment%20ID%5D%5D%3DAdhocTable%5BAssignment%20ID%5D%2CLEN(AdhocTable%5BImmigration%20Status%20Update.Comments%5D)%2C0)))%3C%2FPRE%3E%0A%3CP%3Eentered%20as%20array%20one%20(Ctrl%2BShift%2BEnter).%20I%20take%20CHAR(10)%20(new%20line)%20as%20separator%2C%20you%20may%20change%20on%20any%20other%20symbol%20or%20text.%3C%2FP%3E%0A%3CP%3EPlease%20check%20attached.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-693143%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20formula%20returning%20%23VALUE%20when%20using%20large%20text-based%20field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-693143%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%20%26nbsp%3BBrilliant!%3C%2FP%3E%3C%2FLINGO-BODY%3E
joerames
New Contributor

Working on a report for a customer.  Basic issue is data coming through on multiple rows and customer wants consolidated on one row.  My reporting tool doesn't allow me to consolidate to one row as their query requires.  Couple of approaches, one using pivot, one using arrays INDEX/MATCH/TEXTJOIN.  

So I have a set of data on one sheet in a table.  It's not huge (<1000 rows).  On the other, I've identified the unique reference numbers and placed in column A.  I then go across and do simpler INDEX/MATCHes to get the data in columns where it is the same on all rows.  For the columns where I need to consolidate the 1+ rows, I use the TEXTJOIN.  

{=TEXTJOIN("--",TRUE,IF([@[Assignment ID]]=AdhocTable[Assignment ID],IF(AdhocTable[Immigration Status Update.Comments]=0,"",AdhocTable[Immigration Status Update.Comments]),""))}

It's actually working great, except for a few rows.  The .Comments field is free form text and can be long.  The longest successfully working is 254.  Some go up to 1500 in LEN.

 

I can see the #VALUE in the array when I evaluate the formula for one with a long text field.  Am I running up against some limitation for arrays when using text fields?

 

Pivot works, okay.  But it's not quite as attractive.

4 Replies

@joerames , great finding, I didn't know about that. Yes, it looks like conditional functions as IF() return max 255 characters length text as an array element.

I played with simple model

image.png

the workaround could be

=TEXTJOIN("--",TRUE,LEFT($C$3:$C$5,IF($D$3:$D$5="a",LEN($C$3:$C$5),0)))

(CSE formula).

 

TEXTJOIN itself returns #VALUE if the resulting string is more than 32K length, don't remember exactly.

@Sergei Baklan Sorry for the slow reply.  I haven't quite figured out how to use your advice.  I've attached a sample file.  I messed with it quite a bit.  Not an expert here.

The file has 3 cases.  One is working.  One doesn't error, but returns 0's and I don't want that.  The final case shows the long field and it #ing out.

 

Would love for you to take a peak and help me along!

Solution

@joerames 

 

The formula could be

=TEXTJOIN(CHAR(10),TRUE,LEFT(AdhocTable[Immigration Status Update.Comments],IF([@[Assignment ID]]=AdhocTable[Assignment ID],LEN(AdhocTable[Immigration Status Update.Comments]),0)))

entered as array one (Ctrl+Shift+Enter). I take CHAR(10) (new line) as separator, you may change on any other symbol or text.

Please check attached.

 

Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies