I have a set of cells with values:
A1,B3,C5,D7,E11,F13,G17,H19,I23
I have a formula to select, at random, the value stored in one of these cells:
=CHOOSE(RANDBETWEEN(1,9),A1,B3,C5,D7,E11,F13,G17,H19,I23)
The formula works fine. Now I have assigned a Defined Name to this set of cells - MyPicks
How can I change the formula to use the Defined Name rather than the hard-coded list ??
EDIT#1:
I tried to make the group of cell contiguous by using A1,A2,A3 and sure enough:
=CHOOSE(RANDBETWEEN(1,3),A1,A2,A3)
but =CHOOSE(RANDBETWEEN(1,3),contig)
fails the same way with contig defined as the Name of cells A1,A2,A3:
=CHOOSE(RANDBETWEEN(1,9), MyPicks)
?=index(name,number)
unless the named range is contiguous.=INDEX(named2,,RANDBETWEEN(1,5))
adjusting for a vertical range rather than horizontalCHOOSE
isn't working is because it's seeing the named range as a single value instead of a collection of cells each having their own value. If you use=CHOOSE(1,MyPicks)
then it works fine - although it only returns the value from the first cell - but=CHOOSE(2,MyPicks)
fails because there isn't a second value forCHOOSE
to return.