How to validate an IBAN code with VB/A

Bank accounts are identified with a standardized IBAN code that simplifies international transactions. The code identifies the country, the banking institution and a customer account. You’ll find a function to validate an international Bank account IBAN identifier with VB/A in this post, along with a bunch of test IBANs.

There’s a “checksum” contained in the IBAN, that can be validated using a modulo 97 algorithm. You can peek here for a detailed explanation of the validation: I borrowed the modulo 97 algorithm from some code I found online, and wapped it at my sauce.

The encoding standard in Switzerland has its peculiarities; it has a length of 21 characters and the Bank ID is composed of only number digits. Same rules seems to apply for Lichtenstein (

You will need these small support functions too. IsOnlyNumbers() will return True if a text is composed only of digit characters “0” to “9”, and IsAlphaNum() will return True if the text is composed either of digits or letters “A” to “Z” in UPPER case only.

Here’s a piece of code to test the function, with a bunch of IBANs I gathered online:

Public domain. Enjoy !