Search code examples
google-sheetsgoogle-sheets-formula

IF Function with multiple true values


Google Sheets has the following IF Function:

IF(logical_expression, value_if_true, value_if_false)

Is it possible to have multiple 'values_if_true' where the formula chooses one of those values randomly? If so, how?

example sheet


Solution

  • If you are wanting to select a random value from column B, C or D you can use the INDEX and RANDBETWEEN functions along with an IF

    =IF(A1=1,INDEX(B1:D1,RANDBETWEEN(1,3)),"")
    

    You would then just need to extend the formula to the bottom of your data