• Thanks Sean. By now I've got a very clear idea of what the (mod 23) code does in SQL (code in VBA still pending).

    Basically it takes a number 'ID' like '1234' and calculates the following in each iteration 'i':

    i | mod | mod + i*substring(id,i1)

    1 | 0 0+1 *1=1

    2 | 1 | 1+2*2 = 5

    .........

    7 | .... | 30

    Then 30 mod 23 = 7 --> and 7+1 would be the value used for looking up the corresponding letter, an H ("ABCDEFGHJKLMNPQRSTVWXYZ"). This can be translated into VBA relatively easily, since Substring is equivalent to Excel function Mid.

    Hope this helps someone, a.