11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

566<br />

Part V: Miscellaneous <strong>Formula</strong> Techniques<br />

If you like, you can eliminate the formulas in column B and create a specialized formula that<br />

returns the last name. To do so, substitute the formula in cell B1 for the reference to cell B1 in the<br />

formula. The result is the following array formula:<br />

{=RIGHT(A1,LEN(A1)–(LEN(A1)+1–MATCH(“ “,MID(A1,LEN(A1)+<br />

1–ROW(INDIRECT(“1:”&LEN(A1))),1),0)))}<br />

You must insert parentheses around the formula text copied from cell B1. Without the<br />

parentheses, the formula does not evaluate correctly.<br />

Using a megaformula to determine the<br />

validity of a credit card number<br />

Many people are not aware that you can determine the validity of a credit card number by using<br />

a relatively complex algorithm to analyze the digits of the number. In addition, you can determine<br />

the type of credit card by examining the initial digits and the length of the number. Table<br />

20-4 shows information about four major credit cards.<br />

Table 20-4: Information about Four Major Credit Cards<br />

Credit Card Prefix Digits Total Digits<br />

MasterCard 51–55 16<br />

Visa 4 13 or 16<br />

American Express 34 or 37 15<br />

Discover 6011 16<br />

Validity, as used here, means whether the credit card number itself is a valid number as<br />

determined by the following steps. This technique, of course, cannot determine<br />

whether the number represents an actual credit card account.<br />

You can test the validity of a credit card account number by processing its checksum. All account<br />

numbers used in major credit cards use a Mod 10 check-digit algorithm. The general process is as<br />

follows:<br />

1. Add leading zeros to the account number to make the total number of digits equal 16.<br />

2. Beginning with the first digit, double the value of alternate digits of the account number.<br />

If the result is a two-digit number, add the two digits together.<br />

3. Add the eight values generated in Step 2 to the sum of the skipped digits of the original<br />

number.<br />

4. If the sum obtained in Step 3 is evenly divisible by 10, the number is a valid credit card<br />

number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!