Forum Discussion

JuanjoB's avatar
JuanjoB
Copper Contributor
May 20, 2026

Please allow this foundational concept for algorithms

Hello dear friends of Excel.

Please let me begin by thanking you all for giving us the excellent tool that Ms Excel is.

I've being working practically my whole Computer Engineer career (~18 years) with this awesome tool, and I cannot imagine doing my work without it.
It really is excellent, and has been enhancing a lot in the last years.

 

In this occasion I would like to ask you to consider including in Excel, native support for "empty arrays", that is, arrays that have "0" (zero) items.

This feature would help a lot in the following type of algorithms:

  • When you have to scan a range of cells that hold the items of a set named "S", and
  • from that set you have to select only the items that satisfy a given condition { ALL i | such that CONDITION(i) = TRUE }, and
  • with those selected items (i) you have to construct a new vector named "V"
  • In this case you usually need to begin with an "empty array", that is the initial value before adding any selected item, and
  • at some point as you process the algorithm, maybe you will find the 1st. item to add to the "empty array"
  • Maybe you won't find any item that satisfy the condition, and at the end of the algorithm, you will end up with an "empty array" as a result.

To illustrate this type of algorithm, let me put an example:

=LET(
     vector; SEQUENCE(10);
     new_vector; REDUCE(
        0;
        vector;
        LAMBDA(building_vector;vector_i;
                        IF(RESIDUO(vector_i;2)=1;
                            VSTACK(building_vector; vector_i);
                            building_vector
        )
        )
     );
     INDEX(new_vector;SEQUENCE(ROWS(new_vector) - 1) + 1)
  )

  • This "algorithm", scans a set S = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
  • from S, it selects only the "odd numbers" { ALL i | such that "i is odd" },
  • it takes every odd number and adds it to the array named "building_vector",
  • "building_vector" begins as a non-empty-array, holding "1 sentinel item" at the beginning of the algorithm (the number "0"),
  • at the end of the algorithm, I have to do a work-around, to remove manually the 1st. sentinel item from the array

The cons of this approach are:

  • sometimes the resulting array will not have any selected item, that is, it will be an "empty array", and as such, Excel will generate an error showing #CALC!
  • as Excel doesn't currently support empty arrays, I have to do this workaround to add an initial sentinel item at the beginning of the algorithm, and then I have to remember to remove it at the end of it

Dear friends of Excel, I consider empty arrays to be a "foundational concept for algorithms". It's like the "zero" for numbers, but for arrays.

It would be nice to be able to write this kind of algorithms with the aid of Excel, being able to natively support "empty arrays" without me having to do the extra work of handling a simulated situation of an empty array.

I present you this request, and I ask you to please consider the importance of this feature.

 

Thanks in advance!

No RepliesBe the first to reply