Excel Pick random value in range that is between dates -


i have example setup image below:

enter image description here

i'm trying make formula in cell f3 will:

"select random event between a2:a11 user input date (e3) between start(b2:b11) , finish(c2:c11) dates

the thing can think of is:

=countifs(c2:c11,">="&e3,b2:b11,"<="&e3) 

but returns number of events possible choose from.

any input appreciated

an example of final value either:

event 3 or event 4 because 7/2/2012 occurs between start , finish dates of both events

i came 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).

  1. if((e3>=b2:b11)*(e3<=c2:c11),row(a2:a11)) returns array of row numbers e3 falls between start , finish dates
  2. randbetween(1,sumproduct((e3>=b2:b11)*(e3<=c2:c11))) generates rand number between 1 , count of appropriate events
  3. small(if(..),randbetween(..)) takes random row number array step 1.
  4. index(a:a,small(..)) gets corresponding event name.

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -