mardi 18 octobre 2016

If Cell Starts with String from a List Return Number

What I am looking for is either a formula or Macro/code that will allow me to do the following:

I have a list of the beginning of Postcodes, for example, "AB31, AB32, AB33, AB34", I need something that will return a value of 313 if the start of a cell contains a value from this list I have, and a value of 74 if it does not start with a value from that list.

Now the list is quite long, theres probably 100+ values in there. If there weren't so many values in the list I could use something like

=IF(LEFT(K1,4)="AB51","313","72")

But the list have over 100 values in it. Each value in the list ranges from 2 to 4 characters.

Any help would be much appreciated.

Thanks!

Aucun commentaire:

Enregistrer un commentaire