Solution for Spill Range Unknown error

JDingo

New Member
Joined
Jun 19, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hey everyone,

I've been struggling to figure this one out and I think the only way is an alternative, so I'm hoping I can get some suggestions or solutions.

Cell Formulas
RangeFormula
E46,H46E46=IF(F45>=1,1,"")
E47,H47E47=IF(F45>=2,2,"")
E48,H48E48=IF(F45>=3,3,"")
E49,H49E49=IF(F45>=4,4,"")
E50,H50E50=IF(F45>=5,5,"")
E51,H51E51=IF(F45>=6,6,"")
E52,H52E52=IF(F45>=7,7,"")
E53,H53E53=IF(F45>=8,8,"")
E54E54=IF($F$45>=9,9,"")
E55E55=IF($F$45>=10,10,"")
E56E56=IF($F$45>=11,11,"")
E57E57=IF($F$45>=12,12,"")
E58E58=IF($F$45>=13,13,"")
E59E59=IF($F$45>=14,14,"")
E60E60=IF($F$45>=15,15,"")
J46:J60J46=IF(I46="","",--(RAND()<=$J$45))
G46:G60G46=IF(F46="","",--(RAND()<=$G$45))
G61G61=IFERROR(LET(x,INDIRECT("f46:f"&LOOKUP(2,1/($F$46:$F$60<>""),ROW($F$46:$F$60))),y,UNIQUE(x),SORTBY(y,COUNTIF(x,y),-1)),"")
I45I45=ROUNDUP((I31/6),0)
I46:I60I46=IF(H46<=$I$45,INDEX($J$3:$J$19,COUNTIF($W$43:$W$59,"<="&RANDBETWEEN(MIN($W$43:$W$59),100))),"")
I61I61=IFERROR(LET(x,INDIRECT("i46:i"&LOOKUP(2,1/($I$46:$I$60<>""),ROW($I$46:$I$60))),y,UNIQUE(x),SORTBY(y,COUNTIF(x,y),-1)),"")
F45F45=ROUNDUP((G31/6),0)
F46:F60F46=IF(E46<=$F$45,INDEX($E$3:$E$19,COUNTIF($T$43:$T$59,"<="&RANDBETWEEN(MIN($T$43:$T$59),100))),"")
F61:F69F61=COUNTIF($F$46:$F$60,G61)
H54H54=IF(I45>=9,9,"")
H55H55=IF(I45>=10,10,"")
H56H56=IF(I45>=11,11,"")
H57H57=IF(I45>=12,12,"")
H58H58=IF(I45>=13,13,"")
H59H59=IF(I45>=14,14,"")
H60H60=IF(I45>=15,15,"")
H61:H69H61=COUNTIF($I$46:$I$60,I61)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Oops, sorry, can't figure out how to edit my original post now!

The issue is G61 and I61 only sometimes return a Spill error. Sometimes it's fine.

Basically what's happening is, depending on value in F45, cells F46:F60 will populate a random value (named home player). Then what I want to do in cell G61 is show the unique values and also rank them based on occurance.

As I said, sometimes it works, but more often than not I get a Spill error. I'm starting to think I'll need VBA code to get around this?
 
Upvote 0
Hi & welcome to MrExcel.
No idea why you are getting a spill error & cannot test anything as I don't have your data, but try
Excel Formula:
=LET(Rng,F46:F60,x,UNIQUE(FILTER(Rng,Rng<>"")),SORTBY(x,COUNTIF(Rng,x),-1))
 
Upvote 0
Hi & welcome to MrExcel.
No idea why you are getting a spill error & cannot test anything as I don't have your data, but try
Excel Formula:
=LET(Rng,F46:F60,x,UNIQUE(FILTER(Rng,Rng<>"")),SORTBY(x,COUNTIF(Rng,x),-1))
Thanks for the welcome and idea.

Still receive the spill though.

I've just made a new sheet this may help you see for yourself what is happening? Really appreciate the assistance too!

RLSIM 2022 - V14 try scorers.xlsm
ABCDEFG
1HomePlayer 1100.005.4
2HomePlayer 290.009.1
3HomePlayer 380.003.1
4HomePlayer 470.003.6
5HomePlayer 560.004.9
6HomePlayer 650.004.8
7HomePlayer 740.007.3
8HomePlayer 830.006.6
9HomePlayer 920.003.9
10HomePlayer 1010.009.4
11
12
13
14
15
165
171HomePlayer 45
182HomePlayer 615
193HomePlayer 820
204HomePlayer 230
215HomePlayer 650
2260
2370
2480
25100
26
27
28#SPILL!
290
300
310
320
Sheet1
Cell Formulas
RangeFormula
C1:C10C1=RANDBETWEEN(30,100)/10
B16B16=RANDBETWEEN(1,10)
A17A17=IF(B16>=1,1,"")
B17:B21B17=IF(A17<=$B$16,INDEX($A$1:$A$10,COUNTIF($G$17:$G$25,"<="&RANDBETWEEN(MIN($G$17:$G$25),100))),"")
A18A18=IF(B16>=2,2,"")
A19A19=IF(B16>=3,3,"")
A20A20=IF(B16>=4,4,"")
A21A21=IF(B16>=5,5,"")
C28C28=LET(Rng,B17:B21,x,UNIQUE(FILTER(Rng,Rng<>"")),SORTBY(x,COUNTIF(Rng,x),-1))
B29:B32B29=COUNTIF(B17:B21,C29)
 
Upvote 0
I see what you mean, I can only think that it's something to do with the random numbers, as the formula evaluates correctly.
 
Upvote 0
I see what you mean, I can only think that it's something to do with the random numbers, as the formula evaluates correctly.
Yep, I don't expect the spill error from that particular formula.

Will continue to see if there's workarounds for what I want. Appreciate your help.
 
Upvote 0
Sorry I couldn't have been more help.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,592
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top