View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Creating Function to Reference Cells that Contain Certain Values

One way...

Create a 2 column table like this:

SB...SMBS
SMB...SMBS
SS...SHIN
BB...BBUL

Assume that table is in the range G2:H5

A2 = FS2-670-SB

Enter this array formula** in B2:

=IF(COUNT(SEARCH(G$2:G$5,A2)),LOOKUP(1E100,SEARCH( G$2:G$5,A2),H$2:H$5),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Seraslynz" wrote in message
...
I want to insert a function, I assume an "IF" function that gives me back
different values depending on if the referenced cells contain certain
information.

For example:

A2: FS2-670-SB

If A2 contains the letters "SB" then the function with return "SMBS"

I want to do multiple IF functions so that depending on the "key" letters,
the function will return a certain answer

So, If the cell contains "SB" then return "SMBS", if cell contains "SMB"
cell returns "SMBS", if cell contains "SS" then return "SHIN", if cell
contains "BB" then cell returns "BBUL" etc.