Excel - which formula?

Copper Contributor

I want to insert a formula in a spreadsheet that will do the following;

When specific text codes are entered in a cell, the formula will refer to a table of codes and attribute a value which will be entered into the cell. example;

I type TL in the cell and the value I want that to return in the cell is 1

There are further codes that need a value of 1 returning, and there are further codes that have higher values from 2 to 5.

Which formula do I use?  How do I phrase the formula in excel?  Do I need to put the text codes into a table for look up?

2 Replies

@JayC1 

=IF(OR(B2="TL",B2="UA",B2="ER"),1,IF(OR(B2="WW",B2="QS",B2="GH"),2,IF(OR(B2="UI",B2="OP",B2="KL"),3,"no match")))

Maybe with a nested IF formula.

@OliverScheurich 

Thank you so much, I will give this a try.