Custom Number Format for Cell

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

I need to enter a full credit card number into sales receipts that I've
created in Excel. However, whether on screen, or when printed, I only want
to display the last four digits for security reasons. The only time I would
want to see the full number is if that specific cell is selected. What
customer number format will accomplish this? I've tried #### and 0000, but
to no avail. Running Excel 2002 on Win XP.

Any help is appreciated.

Gary
 
Excel retains 15 significant digits, so it can't store all 16 digits of
a credit card number. You could store the first 12 digits in one cell,
and use a custom number format, such as ****** to hide the cell's
contents. In the cell to the right, enter the last four digits, and
leave them visible. To print a receipt, combine the cell contents:

=C2&D2
 
Very nice solution. Thanks!

Follow up question, if I may. What if I were to store the data as text?
Could it then be contained in one cell? Could I apply the mask?
 
You can store it as text in one cell, but then you wouldn't be able to
apply a custom number format.
 
Back
Top