+ Reply to Thread
Results 1 to 2 of 2

Luhn Algorithm Excel Formula

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2007
    Posts
    1

    Luhn Algorithm Excel Formula

    I am trying to figure out the best method on creating new loan number that are 10 characters in length starting with:
    000030000
    000030001 etc..
    by adding one valid digit using the Luhn method; so here is my scenario:

    When I do the calculations myself manually for the examples above; number are valid
    Loan Number Validity
    0000300004 Valid
    0000300012 Valid

    The validity code I am using is:
    =(--RIGHT( B1,1)=(10-MOD(SUMPRODUCT(--MID("01234567891x3x5x7x9",MID(B1,ROW(INDIRECT("1:"&(LEN( B1 )-1))),1)*(1+MOD(ROW(INDIRECT("1:"&(LEN( B1)-1))),2))+1,1)),10)))

    As for last the digit; if I use a the following formula it provides me a wrong number making my loan number invalid:
    =MOD(1000-SUM(IF(MOD(ROW(INDIRECT("1:"&LEN(A2))),2),3,1)*MID(A2,LEN(A2)-ROW(INDIRECT("1:"&LEN(A2)))+1,1)),10)

    Loan Number Validity
    0000300007 Invalid
    0000300016 Invalid

    Can someone help me with the correct Luhn algorithm excel formula to make my loan numbers valid so that I don't have to do these manually?
    I appreciate any input; thank in advance!

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Luhn Algorithm Excel Formula

    you might find this article useful http://www.devgems.net/?p=193


    click on the * Add Reputation if this was useful or entertaining.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Rainflow algorithm in Excel
    By vamsi tolikonda in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2017, 02:27 PM
  2. Formula that transfers a simple algorithm into excel
    By parisdoil123 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-20-2012, 09:59 AM
  3. [SOLVED] Luhn Algarithm for Library Barcoding
    By Sethinstein in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 11:38 AM
  4. Luhn Check algorithm in Javascript
    By shanajiq in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2011, 08:47 AM
  5. Chi-squared P-value Algorithm in Excel
    By DuyTran in forum Excel General
    Replies: 0
    Last Post: 09-25-2011, 09:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1