I have my example setup like the image below:

I'm trying to make a formula in cell F3 that will:
"Select a random EVENT between A2:A11 where the USER INPUT DATE (E3) is between the START(B2:B11) and FINISH(C2:C11) dates
The only thing I can think of is:
=COUNTIFS(C2:C11,">="&E3,B2:B11,"<="&E3)
But that only returns the number of EVENTS that are possible to choose from.
Any input would be appreciated
AN EXAMPLE OF A FINAL VALUE FOR THIS WOULD BE EITHER:
Event 3 or Event 4 because 7/2/2012 occurs between the start and finish dates of both events
I came up with this formula:
=INDEX(A:A,SMALL(IF((E3>=B2:B11)*(E3<=C2:C11),ROW(A2:A11)),
RANDBETWEEN(1,SUMPRODUCT((E3>=B2:B11)*(E3<=C2:C11)))
)
)
with array entry (CTRL+SHIFT+ENTER).
IF((E3>=B2:B11)*(E3<=C2:C11),ROW(A2:A11)) returns array of row numbers where E3 falls between START and FINISH datesRANDBETWEEN(1,SUMPRODUCT((E3>=B2:B11)*(E3<=C2:C11))) generates rand number between 1 and count of appropriate eventsSMALL(IF(..),RANDBETWEEN(..)) takes random row number from array from step 1.INDEX(A:A,SMALL(..)) gets corresponding event name.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With