This works good for numbers that are easly decomposed in 10th powers, but

what about strange numbers like mod(13523456273456;97). It's difficult ...

Hi. A 14 digit number can be done more directly via your code you listed

earlier.

Function MyMod(x, y)

MyMod = x - Int(x / y) * y

End Function

Hence

=MyMod(13523456273456,97) -> 8

I am not exactly sure what the second code (MulMod32) is for.

In your main code, you are using Excel's MOD function. For some unknown

reason, Microsoft refuses to fix this bug, despite being asked for years.

You may want to use your own MOD function from above instead.

(I'm still stuck on this part

BX2N = MulMod32(BX2N, BX2N, N)

It "appears" to me to be an error, but it does work. (If done this way, I

was expecting MulMod32(BX2N, 2, N) )

I'll have to study it some more. However, it gave me a great idea on my own

code. Thanks.

Anyway, Large numbers can be broken down into smaller steps. Here's an

example of a 37 digit number.

The idea here is that you Mod a smaller group of the numbers. You append

the results to the beginning of the next group of numbers.

Sub TestIt()

Dim n As String

Dim x As Long

n = "1234567890123456789012345678901234567"

x = sMod(n, 97)

Debug.Print x

'// Your example

x = sMod("13523456273456", 97)

Debug.Print x

End Sub

Function sMod(n As String, x As Double) As Double

'// Mod(N, x) where N is a Long string

Dim s As String

Dim z As String

Dim P As Long

Const Stp As Long = 7

z = vbNullString

For P = 1 To Len(n) Step Stp

s = z & Mid$(n, P, Stp)

z = CStr(CDbl(s) Mod x)

Next P

sMod = CDbl(z)

End Function

On your question of

Suppose you have this number for a bank check:

00020001 01234567890 12345678CD 12

I am not familiar with this, but the placement of the check digit appears to

be incorrect.

I was expecting it to be the last two digits.

There are lots of internet recourses, but here's one...

http://www.pangaliit.ee/files/eng_Codes/implementation.pdf
Does your data follow the pattern listed there?

For your Mod question, Steps 1.1 - 1.3 near the botton are following the

code above.

Step 1.2 is a little confusing.

What they are doing is taking 67 from step 1.1 and appending it to "6789012"

So, what they are actually doing in step 1.2 is Mod(676789012,97) ->30

Anyway, hope this is of some help. Good luck.