Question: I'm new to JavaScript and feel like I must be missing something fundamental here!

I'm creating a function which sorts a list of integers `list` and returns the minimum value `listSort[0]`.

```
function sortNumber(a,b) {
    return a - b;
}

var min = function(list){
    console.log(list[0]);
    var listSort = list.sort(sortNumber);
    console.log(list[0]);
    console.log(listSort[0]);
    return list[0];
}

```

Can anyone explain why the value of `list[0]` changes after `list.sort(sortNumber)` is assigned to `listSort` ?

Thanks!

Answer: 
Add all the different combination of characters in the lookup. 

If a particular character is not found in the lookup, the result will be N/A.

`=VLOOKUP(RIGHT(C2,1),G2:H3,2)*SUBSTITUTE(C2,RIGHT(C2,1),"")`

[![enter image description here](https://i.stack.imgur.com/BKwz2.png)](https://i.stack.imgur.com/BKwz2.png)

Tip: When you drag/fill the formula the reference of the vlookup also changes, to avoid that add '$' to cell reference.

`=VLOOKUP(RIGHT(C2,1),$G$2:$H$3,2)*SUBSTITUTE(C2,RIGHT(C2,1),"")`
If it is just the two; K and M, then the following will do what you want:

```
=LEFT(A1,LEN(A1)-1) * IF(ISNUMBER(SEARCH("k",A1)),1000,1000000)

```

[![enter image description here](https://i.stack.imgur.com/uipfQ.png)](https://i.stack.imgur.com/uipfQ.png)

---

To do it in place with vba:

```
Sub foooooooo()
    Dim rng As Range
    Dim ws As Worksheet

    Set ws = Worksheets("Sheet12") ' Change to your worksheet name

    With ws
        'Change the "A" to the column in which you have the numbers and the 1 to the first row of numbers
        Set rng = .Range(.Cells(1, "A"), .Cells(.Rows.Count, "A").End(xlUp))
        rng.Value = .Evaluate("=INDEX(LEFT(" & rng.Address & ",LEN(" & rng.Address & ")-1) * IF(ISNUMBER(SEARCH(""k""," & rng.Address & ")),1000,1000000),)")
    End With
End Sub

```