Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contents of Cell

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I am looking to find if a cell contains a 12 digit string of numbers. This cell can and does contain numbers and text, it is used as a "notes" field and I am looking for a formula/VBA that would return a yes or no if anywhere in the cell a string of 12 numbers(a credit card number) appear together in that cell.

Any help or suggestions welcome.

Thank you!

Paul
 
Hi,

How about the Find() function?

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I thought of the find() or Search() functions as well but what i cant figure out is how to have the formula search or find for a 12 digit number in the contents of the cell. I am assuming that the IF and LEN() functions would come into play as well but i cannot seem to figure the logic or correct context to get the desired results.
 
I was able to solve this by using REGEX in excel using "\b(?:\d[ -]*?){13,16}\b".
 
Skip, that was my mistake....12, 16 same difference! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top