16 digit number, last number changes to 0

pcar

New Member
Joined
Jun 26, 2008
Messages
8
I work for a financial institution, and we are creating a worksheet that lists card numbers. The card numbers, like most other card numbers, are a 16-digit mod-10 number. We're not doing any of the calculations in excel, we're just simply entering in the card number as it appears on the card. The problem is that the last digit is changing to a "0". What is going on and how can we stop it?
 
Does anyone know why this happens, or is it like the mystical force that removes socks from the dryer and will never be explained.....
<!-- / message -->
Did you miss post # 4 by schielrn ? That points to an article at Microsoft that explains it.
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Schielrn's already given you Microsoft's explanation (or a link to it) - Excel abides by IEEE754 standard on precision for floating point accuracy which means only 15 digits' worth. 16 digit credit card numbers exceed this hence they drop the final digit (which becomes zero).
 
Upvote 0
MS work to IEE standards for numerical data types. Their standard is 'upto 15 digits'. It's due to the way numbers are stored as 1 byte in 16/32bit processors (can't remember which)

It's the same with additions, if you add up a lot of fractions it may add up incorrectly when you add more than 255 numbers. If you've ever used a pivot table to add up debits and credits that should zero each other out, it's a pain in the proverbial as it will add up to 0.0000002, clearly wrong as none of the numbers have more than 2d.p. Just something we have to live with I'm afraid.

VBA is better as it has better number types which can accomodate far larger and far more precise numbers with accuracy, as it uses several bytes for a number if you so specify.
 
Upvote 0
Hmm, I was always of the opinion that VBA and Excel were equivalent in their precision (both Double data type at their max), with the exception that VBA also has a 64-bit data type in the Currency (I think, anyhow).
 
Upvote 0

Forum statistics

Threads
1,216,471
Messages
6,130,822
Members
449,595
Latest member
jhester2010

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top