+ Reply to Thread
Results 1 to 6 of 6

(Help) Excel Returning `0` in Cell, 2D Array expected

  1. #1
    Registered User
    Join Date
    08-07-2023
    Location
    Missouri, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Question (Help) Excel Returning `0` in Cell, 2D Array expected

    I have a 2D Array of data in `A2#`. In three cells outside this range, I have three very simple formulas:

    `=LEN(A2)`
    `=LEN(A2:E15)`
    `=LEN(A2#)`

    The first cell evaluates to `4`, the expected result (A2 contains a 4-char word).
    The second cell evaluates to a 2D array of all the lengths in the range, with `0`s included for blank cells (expected).
    The third cell appears to take a long time to evaluate, but never does. There is no sign that it is calculating, except it doesn't appear to respond (until I press any button). When any button is pressed, the formula immediately evaluates to `0` and proceeds to acknowledge the button I pressed (arrow keys move the cursor, typing a key puts that character in the below cell, etc) but only after I press a button. Otherwise it sits there forever, in the text of the formula, waiting.

    I expected a 2D array exactly the size of `A2#`, with lengths listed.
    My overarching goal was to turn this 2D array of words into a single column with all words listed, no blanks (there are blanks in the original array).

    If you can assist with the problem at hand (or even a bigger problem I am trying to accomplish), please don't hesitate. Thanks!

  2. #2
    Registered User
    Join Date
    08-07-2023
    Location
    Missouri, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Re: (Help) Excel Returning `0` in Cell, 2D Array expected

    I always feel a little silly when I solve the issue myself not long after posting, but I was struggling with this for a few hours already.
    In any case, I found out something odd. I'm not exactly sure what's happening, so I'll explain what I did and hope someone else understands.

    I neglected to mention that immediately to the right of the range I specified, there are a few columns with more dynamic arrays (only 1D this time).
    My first step was trying to see how large I could make the selection before it quit calculating, to see if I hit some limit. For clarification, my array is 14 columns by 86681 rows large. It exists at A2:N86682. Again, there is data in dynamic arrays at O2:O86682, P2:P86682, and a couple after that. Here are a few more formulas and their output:

    `=LEN(A2:N2)` -> `0`, similar issue as above
    `=LEN(A2:M86682)` -> expected 2D array (which took very little time to calculate)
    `=LEN(A2:N86682)` -> `0`, same issue as above

    I then realized I had the dynamic tables hidden in column O and following. I unhid them, and the issue persisted. I inserted a new column before O, placing it at O and shifting the dynamic arrays to P. All of a sudden, when recalculating `=LEN(A2#)`, it worked like a charm! I was quite surprised. Naturally curious, I deleted column O again, restoring the dynamic tables to be immediately after the 2D array. And to my further shock, I did not experience the original issue. If I did not record my troubles, I would probably feel as if I were gaslighting myself.

    Now that all of this has happened, I am inclined to believe that I have found some sort of bug in Excel. As for reproducibility, I honestly have no clue. I personally never want to experience this again.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,866

    Re: (Help) Excel Returning `0` in Cell, 2D Array expected

    I would doubt it's a bug. Every now and again Excel can get caught in calculation 'loops' where many calculations over several formulae are contributing to an outcome: this might be because the calculations are processor-hungry or the arrays are huge or both, or even the fact that the device is doing something OUTSIDE of Excel at that moment that gets in the way - I'd suspect in your case the latter.

    To filter your list, use:

    =LET(t,TOCOL(A2#),FILTER(t,t<>""))

    BUT this may not work if the 1D array formed with the blanks included is longer than the maximum rows allowed in a worksheet (but you can try it).
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: (Help) Excel Returning `0` in Cell, 2D Array expected

    I'm not sure I follow you.

    However, I created an array 500,000 rows, 20 columns, each containing an 11 digit number :

    =SEQUENCE(500000,20,10000000000)

    in A1. Then in W1:

    =len(A1#) calculated perfectly (if slowly) and =sum(len(A1#)) also calculated perfectly.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    08-07-2023
    Location
    Missouri, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Re: (Help) Excel Returning `0` in Cell, 2D Array expected

    Thanks for the help! I didn't know of TOCOL until now!

    Unfortunately, though, you were right. It won't let me TOCOL the entire array (14x86681). I know from using the count functions that I have 302026 cells with contents. Also, I've made SEQUENCE arrays of this size. However, I assume that because TOCOL is run first, it tries to generate an array that is too large, and I get a `#NUM!` error. Is there a way to run TOCOL with BYROW? or maybe with SCAN? Or is there another way to work on the array bit-by-bit?

    Also, TOCOL has a parameter to "Ignore Blanks," but when I set it to 1 it keeps them anyway. What is this feature for?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: (Help) Excel Returning `0` in Cell, 2D Array expected

    Also, TOCOL has a parameter to "Ignore Blanks," but when I set it to 1 it keeps them anyway. What is this feature for?
    It should really read "Ignore Empty" as it will ignore cells that are totally empty, but not cells that contain ""

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 12-11-2021, 06:45 AM
  2. [SOLVED] Table index result NOT returning expected value/cell
    By ZMAFC94 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-07-2018, 11:17 AM
  3. Expected table is not in the expected format - ADODB Connection to Read Only Excel file
    By Roshan10043 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2018, 10:54 AM
  4. Replies: 3
    Last Post: 07-01-2014, 03:11 PM
  5. [SOLVED] VLOOKUP cell reference not returning expected values
    By okcsteve in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-31-2013, 11:50 AM
  6. Replies: 11
    Last Post: 04-14-2013, 12:02 AM
  7. One cell in an array forumla not returning expected values
    By brharrii in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-08-2013, 03:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1