Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Credit Card Verification

  1. #1
    Guest

    Default

    Hi all,
    I have an interesting one... am looking for a way to verify a credit card number using the check digit (there's standard formula). I saw the source code on the net but its in C. Just wondering does anyone have it in vba. Thanks.

  2. #2
    Guest

    Default

    If the code in C is short, slap it in here and maybe a kind person code convert it to VB.

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,940
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    There are loads of code examples around in any language you can think of. How about this:-

    http://mskadu.freeservers.com/articl...luhncheck.html

    HTH,
    D

  4. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    for a non-VBA approach, try this cumbersome formula :

    assuming A1 houses your credit card number :

    =IF(MOD(SUM(IF((MID(TEXT(+A1,"00000000000000000000"),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20},1)*({2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1}))<10,(MID(TEXT(+A1,"00000000000000000000"),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20},1)*({2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1})),MID((MID(TEXT(+A1 ,"00000000000000000000"),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20},1)*({2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1})),1,1)+MID((MID(TEX T(+A1,"00000000000000000000"),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20},1)*({2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1;2;1})),2,1))),10)=0,"Okay","Not valid")

    I'm sure it could be shortened *slightly*, but it seems to work on my credit card numbers (first 15 digits). It looks at the number for validity rather than the check digit, so not exactly what you asked for, but it might help.




    :: Pharma Z - Family drugstore ::

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •