Question: I have some price codes, for example `BBAXV` and `GGZTR`, to convert to numbers, respectively `22300` and `44000`, according to these rules: 

```
F > 1  
B > 2  
A > 3  
G > 4  
O > 5  
J > 6  
L > 7  
C > 8  
E > 9  
Else > 0
```

I'm currently using VBA: 

```vb
Function SubstituteMultiple(text As String, old_text As Range, new_text As Range)
    Dim i As Single
    For i = 1 To old_text.Cells.Count
        Result = Replace(LCase(text), LCase(old_text.Cells(i)), LCase(new_text.Cells(i)))
        text = Result
    Next i
    SubstituteMultiple = Result
    End Function

```

with for example:

```
=SubstituteMultiple(A2,$D$2:$D$3,$E$2:$E$3)

```

Is there instead any simple formula I can use for this?

Answer: 
Any length (within reason)

```
=SUM(10^(LEN(A1)-ROW(INDIRECT("$1:$" & LEN(A1)))) *  
  IFERROR(SEARCH(MID(A1,ROW(INDIRECT("$1:$" & LEN(A1))),1),"FBAGOJLCE"),0))

```

Ctrl+Shift+Enter since it's an array formula.
I guess not simpler, but at least an alternative. Text to Columns Fixed width to separate each character (ColumnsA:E). A formula for the transliteration: 

```
=IF(A1="","",IFERROR(VLOOKUP(A1,Table,2,0),"0"))  

```

in H1, copied across to L1 and down to suit, a table (named `Table`) for the conversion rules (P1:Q8) and finally some concatenation to reassemble the components: 

```
=H1&I1&J1&K1&L1  

```

in N1 and copied down to suit: 

[![SO3062243 example](https://i.stack.imgur.com/Vx0Vi.jpg)](https://i.stack.imgur.com/Vx0Vi.jpg)