Forum Discussion

jsmith-icodevelopment's avatar
jsmith-icodevelopment
Copper Contributor
May 24, 2023
Solved

MIN of a 3D Array to Spill

I'm creating a sensitivity table that uses the new dynamic arrays to spill in two dimensions. However, one of the calculations I am using needs to both create a 3D array, and then find the min for ea...
  • PeterBartholomew1's avatar
    PeterBartholomew1
    May 26, 2023

    jsmith-icodevelopment 

    I think the approaches you are exploring are important.  

    I regard the grid as providing the means for manipulating multidimensional arrays and displaying the results.  To most users it provides a default referencing framework for formulas but I haven't used an A1-type reference for 8 years.  I use defined names to declare a region of the sheet to be part of my model and to indicate what data should be placed within the region.

     

    Back to your problem.  I didn't bother about the individual parts of the 3D range (strictly speaking a 2D representation of the implied 3D array) but named the overall data structure 'Array3D'.

    = LET(
          MINλ,     LAMBDA(x, MIN(x)),
          reshaped, WRAPCOLS(TOCOL(Array3D), 30),
          minima,   BYROW(reshaped, MINλ),
          DROP(WRAPROWS(minima, 5), -1)
      )

     The differences are that I used LET to split a nested formula into steps, tended to run the longer array dimensions down the sheet rather than across, and named the Lambda function rather than using it as an anonymous function.  All of these are minor aesthetic points and others are free to disagree.

Resources