I think you can.
The last digit in (some/all) credit card numbers serves as a kind of checksum
digit. But it's not quite just adding the digits.
This site explains how the credit card numbers can be validated.
http://www.merriampark.com/anatomycc.htm
If you can validate the potential credit card number, I would think you could
guess a (any?) missing digit in the number.
I formatted the cells as Number with no punctionation (dashes/commas/etc). (I
used the .text property of what's in the cell.)
So you could try inserting an extra column and putting a formula like:
=guesscard(a1)
and drag down.
Option Explicit
Function GuessCard(rng As Range) As String
'
http://www.merriampark.com/anatomycc.htm
Dim iCtr As Long
Dim myStr As String
Dim okCheckSumCtr As Long
If Len(rng.Text) <> 16 _
Or Right(rng.Text, 1) <> 0 _
Or IsNumeric(rng.Value) = False Then
GuessCard = "Not correct format"
Exit Function
End If
myStr = ""
okCheckSumCtr = 0
For iCtr = 0 To 9
If CheckCard(Left(rng.Text, 15) & iCtr) = True Then
okCheckSumCtr = okCheckSumCtr + 1
myStr = Left(rng.Text, 15) & iCtr
End If
Next iCtr
Select Case okCheckSumCtr
Case Is = 0: GuessCard = "Not Valid"
Case Is = 1: GuessCard = myStr
Case Is > 1: GuessCard = "More than one!"
End Select
End Function
Function CheckCard(TestNumber As String) As Boolean
Dim iCtr As Long
Dim charSum As Long
Dim tempSum As Integer
iCtr = 1
charSum = 0
tempSum = 0
For iCtr = 1 To Len(TestNumber)
charSum = Val(Mid(TestNumber, iCtr, 1))
If (iCtr Mod 2) = 1 Then
charSum = charSum * 2
If charSum > 9 Then
charSum = charSum - 9
End If
End If
tempSum = tempSum + charSum
Next iCtr
tempSum = tempSum Mod 10
CheckCard = CBool(tempSum = 0)
End Function
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
(ps. This guessed my credit card numbers correctly.)