Skip to main content

IBAN Validation

This function will return a 1 if the IBAN adheres to the validation else it will return 0 if it is false.

The International Bank Account Number (IBAN) is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors.

An IBAN is validated by converting it into an integer and performing a basic mod-97 operation (as described in ISO 7064) on it. If the IBAN is valid, the remainder equals 1.

I have tested this against the examples listed on the source page but it has not been extensively tested.  So if anyone uses this and finds problems, or can validate that it works properly I would appreciate a comment.

Source: http://en.wikipedia.org/wiki/International_Bank_Account_Number

March 17, 2015 - Updated the custom function so it can now handle IBANs that are longer than 30 characters.

wmollink Sun, 03/15/2015 - 16:55

Hello Brian
I tested the function on a large batch of IBAN-numbers. I got 6 (out of about 30.000) that gave validation 0. I checked these online and they checked out all right.
So I looked at your code and changed it, so the function gave the length of the number after converting it to numbers and removing the spaces. It turned out that the 6 had a length of more then 30. The longest were 37 long (countrycode MT). So I added a fifth round and then all the numbers checked out all right.
I am using Idea 8.5 and looked in the language browser for the mod-function, but could not find it. Yet the function worked all right. Is this an error in the language browser? If so do you know of any more of these mistakes?
Greetings
Wim

Brian Element Mon, 03/16/2015 - 07:44

In reply to by wmollink

Hi Wim,

Thanks for the information, I guess I had assumed 30 would be the max.  I will look at the code and maybe add a loop depending on the length of number to validate.  That would hopefully handle items that might be even longer than your 37 characters.

Actually the Mod is a visual basic key word and not an IDEAScripting key word.  There are quite a few visual basic commands that work in IDEAScript that are not documented in the language browser.  I have listed some of them in the VB language section of the site but I haven't had a chance to go through all of them.  The only way to know if they work is to test them out and unfortunately sometimes they work as planned and other times they don't, it has been a bit of a hit and miss sometimes.

Thanks

Brian

MagiBzh Thu, 12/08/2016 - 07:47

Hi Brian,
Hope evrything is well with you. I tried to use your function but I got an error message saying "syntax error". could you please advise on what to do to make this function works ?
Many thanks for considering my request.
Magi

MagiBzh Thu, 12/08/2016 - 11:01

Hi Brian,
IDEA version 9.2.0.630 (X86 Unicode) :)

Brian Element Thu, 12/08/2016 - 20:29

In reply to by MagiBzh

Hi Magi,

I just tried it on 9.2 with no problems.  Are you using it on a character field?  The only other difference is that you are using unicode and mine is ASCII, unfortunately I don't have a unicode version to test it out on.

Brian

MagiBzh Fri, 12/09/2016 - 03:53

Hi Brian,
Yes it is a character field.
Magi

Brian Element Fri, 12/09/2016 - 07:17

In reply to by MagiBzh

Hi Magi,

Then I am not sure what the problem might be as I can get it to work.  The only thing I can think of is some preblem between the ASCII and Unicode versions of IDEA.  Any chance you can get a screen capture of the error message.

Thanks

Brian

MagiBzh Fri, 12/09/2016 - 09:31

Hi Brian,
I upload a screenshot. the character field "BANK_ACCOUNT_NUM" has 31 length, do you think it could be the problem ?
Br,
Magi

The website encountered an unexpected error. Try again later.