Special introduction to excel



Download 1.18 Mb.
Page10/11
Date09.06.2018
Size1.18 Mb.
#54022
1   2   3   4   5   6   7   8   9   10   11

b. Add another panel to the spreadsheet that takes as input a six-digit account number and uses the check digit formula in part a to test whether or not the account number is valid. Your solution should look like this:











  • Solution: This formula in the “Valid? (Y/N)” column will test any six-digit account number:



  • =IF(H20=MOD(((C20*5)+(D20*4)+(E20*3)+(F20*2)+G20),7),"Y","N")



  • Ideally, all a user should need to do is input a six-digit account number in the “Account number” column and then the spreadsheet will display the individual digits in the appropriate columns. This requires the following formulas to parse the six-digit account number entered in cell B20 (you can copy these formulas down for as many rows as desired):



  • “First digit” column: =VALUE(LEFT(B20))

  • “Second digit” column: =VALUE(LEFT(RIGHT(B20,5)))

  • “Third digit” column: =VALUE(LEFT(RIGHT(B20,4)))

  • “Fourth digit” column: =VALUE(LEFT(RIGHT(B20,3)))

  • “Fifth digit” column: =VALUE(LEFT(RIGHT(B20,2)))

  • “Check digit” column: =VALUE(RIGHT(B20))



  • Alternatively, if you only want a two-column display with the account number and the “Valid? (Y/N)” column, you could modify the formula in the “Valid? (Y/N)” column so that the cell references were replaced as follows:



  • =IF(H20=MOD(((VALUE(LEFT(B20))*5)+( VALUE(LEFT(RIGHT(B20,5)))*4)+( VALUE(LEFT(RIGHT(B20,4)))*3)+( VALUE(LEFT(RIGHT(B20,3)))*2)+ VALUE(LEFT(RIGHT(B20,2)))),7),"Y","N")






  • Download 1.18 Mb.

    Share with your friends:
  • 1   2   3   4   5   6   7   8   9   10   11




    The database is protected by copyright ©ininet.org 2024
    send message

        Main page