Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

#SPILL! error in LET() function despite good array return

0

I am creating a formula that can take an array of items as an input and then output a sub-array of those items. The sub-array cannot have repeat items and must be at least 1 cell in length and at most x cells in length (where x = array size). The size of the sub-array is incrementally weighted towards smaller sizes. Once the size is chosen, it is equally probable that any set of items is included in the sub-array. Example

Array: bear, cat, dinosaur, dog, dolphin, zebra

Sub-array size(weight): 1(6), 2(5), 3(4), 4(3), 5(2), 6(1)

Sub-array size p = weight / sum weights (e.g. p(size=3) = 4 / (1+2+3+4+5+6) = ~19%)

Given a size of 5, there should be an equal chance that any five animals are included.

The issue here is that if you recalculate the sheet enough times, sometimes the LET() formula returns a #SPILL! error even though the 'Evaluate Formula' feature clearly shows that my final 'sorted' arguement in LET() returns a valid array. What gives? Thank you!

Answer
Discuss

Discussion

Hello VortexCortex and welcome to the forum,

Sorry, but my skills don't go beyond Excel 2016 so I don't have experience with the newer SPILL and LET functions. Maybe John_Ru will see your post and provide some help.

Cheers   :-)
WillieD24 (rep: 723) May 2, '26 at 4:52 pm
Hi VortexCortex.

Sorry but I haven't been paying attention to this Forum recently. I'll take a look and see if I can help.

John_Ru
John_Ru (rep: 6792) May 13, '26 at 1:20 pm
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login