excel - Pull a random value from a list if another column has a value in same row -
i have list of named entities , chart of how have been audited:
name may june july aug alpha 2 1 1 beta 1 1 gamma 1 1 1 delta 1 1 i'm trying have cell display in given month wasn't audited @ least once.
the best have managed has been using 2 cells, 1 named "randnum"
=index(a2:a5,randbetween(1,counta(a2:a5))) and cell use random returned value, if value returned has been audited month says "try again." in example 4 column july. when hit delete on blank cell updates.
=if(vlookup(randa,a2:e5,4)>=1,randnum,"try again") i'd rather not resort vba if can i'm open it.
=index($a$1:$a$5,large((index($b$2:$e$5,,match(d9,$b$1:$e$1,false))=0)*(row($a$2:$a$5)),randbetween(1,countif(index($b$2:$e$5,,match(d9,$b$1:$e$1,false)),""))),1) put month want in d9 , enter above array formula (ctrl+shft+enter)
index($b$2:$e$5,,match(d9,$b$1:$e$1,false)) this part in 2 places. returns column in question. if put july in d9, return d2:d5. if put aug return e2:e5. if misspell something, you'll error.
(index(...)=0)*(row($a$2:$a$5)) this returns array that, july, looks {0,3,0,5} , august looks {2,3,4,5].
randbetween(1,countif(index(...),"")) this picks random number between 1 , count of blank cells in column.
large(array,randbetween(...)) this picks nth largest row in array, nth random. won't pick 1 that's been audited because 0 in array , 0 won't ever largest (unless everyone's been audited).
=index($a$1:$a$5,large(...),1) finally, nth largest row put in index return name.
Comments
Post a Comment