Recommended Solution for using IF, IFS, or Lookup in Excel Data Sheet

Copper Contributor

Hi guys!

I'm working on my data table and used this formula to come up with random orders for my customers to save me time.

 

=CHOOSE(RANDBETWEEN(1,11),"Conchas","Champurrado", "Puerquitos", "Ponche", "Empanadas", "Atole", "Conos de Crema", "Café de Olla", "Besos","Chocolate Caliente", "Mantecadas")

 

However, now I'm working on a category column, to where it should show me a food item as a pastry but if they're a non-food item a drink.  

 

This is what I used: 

 

=IF((OR(D3=Conchas,D3=Puerquitos,D3=Empanadas,D3=Conos de Crema,D3=Besos,D3=Mantecadas)),"Pastry","Drink")

 

but it kept showing #NAME? instead of the result 

 

I would like to have Conchas, Puerquitos, Empanadas, Conos de Crema, Besos, and Mantecadas shown as a "Pastry" result and Champurrado, Ponche, Atole, Café de Olla, and Chocolate Caliente shown as a "Drink" result.

 

How would y'all suggest the format of my formula to be? And what should I use? I would really appreciate y'alls help!  

1 Reply

@whalien52 

I'd create a list of items and categories, for example on another sheet:

S0121.png

You can then use a VLOOKUP formula. In the example below, I assume that the sheet with the list is Sheet2.

S0122.png

The formula in B2 is =VLOOKUP(A2,Sheet2!$A$2:$B$12,2,FALSE)

PS in A2, I used =INDEX(Sheet2!$A$2:$A$12,RANDBETWEEN(1,11))

This makes it easy to change an item in the list. Both formulas will pick up the change automatically.