# How do I write a formula to return a category based on the item(s) in a cell?

In this example, the first column contains various fruits and vegetables (multi select dropdown). I want to write a formula that returns the category (fruits or vegetables) based on the first item

Thanks!

Tags:

• I have a similar scenario except that I want to count how many votes from Top 10 Ranked column based on the No. column. I want it to automatically update in the Sheet Summary. (I manually entered what I want it to look like in the Sheet Summary).

Thanks!

• Hi D. Rojas.

Formula:

=INDEX(Scenario:Scenario, MATCH(LARGE(Results:Results, 1), Results:Results, 0)) + "-" + LARGE(Count:Count, 1) + " " + "Votes" + UNICHAR(10) + INDEX(Scenario:Scenario, MATCH(LARGE(Results:Results, 2), Results:Results, 0)) + "-" + LARGE(Count:Count, 2) + " " + "Votes" + UNICHAR(10) + INDEX(Scenario:Scenario, MATCH(LARGE(Results:Results, 3), Results:Results, 0)) + "-" + LARGE(Count:Count, 3) + " " + "Votes"

I did not find real RAND in Smartsheet so I used scenario number/1000 instead of that.

Hopefully will help.

Tatiana

• Hi gracen.

Please see suggestion below (I added reference columns to divide which item is fitting to fruits and which to vegetables but can be as part of formula directly if you has not too many different values).

Hopefully will help.

Tatiana

• Thank you so much Tatiana for the detailed formulas! This is very helpful 😃

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!