MrExcel Publishing
Your One Stop for Excel Tips & Solutions

custom cell format

Posted by rock on August 10, 2001 7:50 AM

I am trying to formet a cell to accept a credit card number without me having to enter dashes but the last number keeps comming up a zero, i.e. card number 1234-1234-1234-1234-1234 will come up 1234-1234-1234-1230 even after setting a custom cell format of
0000-0000-0000-0000. I have also tried
####-####-####-####, neither one works.

What am I doing wrong?

Posted by Joe Was on August 10, 2001 8:10 AM

Sorry Excel has a 15 digit limit!
Try using two cells, half in each. JSW

Posted by Ryan on August 10, 2001 8:14 AM

My guess is that the number is too large for Excel. Try this:

If Card number is in A1 as text (put an ' in front of the number or change the cell formats to text)

=LEFT(A1,4) & "-" & MID(A1,5,4) & "-" & MID(A1,9,4) & "-" & MID(A1,13,4)