Home > Mobile >  Google Sheets Formula: Map String Value in Dropdown to Number for use in Formula?
Google Sheets Formula: Map String Value in Dropdown to Number for use in Formula?

Time:01-12

Let's say I have a cell A1 with possible dropdown values {Apple,Banana,Cherry}. The chosen string determines which constant to use in the formula for B1. What is the best way to do this in Google Sheets?

CodePudding user response:

if {Apple,Banana,Cherry} = {1,2,3} then try:

=MATCH(A1, {"Apple"; "Banana"; "Cherry"}, 0)

or:

=VLOOKUP(A1, {"Apple", 1; "Banana", 2; "Cherry", 3}, 2, 0)

CodePudding user response:

If you have a lot of dropdown options, a lookup table is the best way to approach this. Otherwise SWITCH() > IFS() > IF().

If you are having trouble implement this please share a dummy sheet.

  •  Tags:  
  • Related