excelroulette-wheel-selection

Matching number and color in roulette simulator


I am trying to build an roulette game in Excel. Due to this blog post I am able to randomly select numbers that are provided in column D Spin number. Now I would like to auto-fill E, Spin color based on the columns B Actual Number and C Color.

For example: If D is 17 as in D3 (see below), the formula will look up 17 in B which is B10 and will provide the corresponding Color C10 in E Spin Color in E3. Therefore, 17 in D3 would lead to "Black" in E3.

As I am not very strong in Excel I would appreciate, if someone could provide an answer. Thank you so much!

Edit: With every new run the numbers in column D will change and E has to change accordingly.

enter image description here


Solution

  • You can do this with VLOOKUP:

    =VLOOKUP($D2,$B$2:$C$11,2,false)
    

    or with INDEX / MATCH (which is faster):

    =INDEX($C$2:$C$11,MATCH($D2,$B$2:$B$11,0))