IBAN Validation
Forums
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.
Hi Wim,
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
Hello Brian
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