View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How to substitute whole word with different designated letters?

Hi,

Not sure about a formula but here's a UDF. Alt+F11 to open VB editor, Right
click 'This workbook' and insert module and paste the code below in
in A15 enter the formula
=Subst(A1)


Function Subst(oldstring As String) As String
For x = 1 To Len(oldstring)
Mid(oldstring, x, 1) = WorksheetFunction.VLookup(Mid(oldstring, x, 1), _
ActiveSheet.Range("O1:P26"), 2, False)
Next
Subst = oldstring
End Function

Mike

" wrote:

Hi,

Is there a way to substitute letters from a word in a cell, with
predifined letters for the whole word?

Cell A1 contains the word. OLE.
Cells O1:O26 have the letters of the alphabet and cells P1:P26 have
the replacement letter.

I need a formula on cell A15 that will take the word OLE in cell A1
and replace all those letters with its match on cells P1:P26.

Thanks