+ Reply to Thread
Results 1 to 4 of 4

String manipulation and pattern recognition

  1. #1
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    String manipulation and pattern recognition

    I'd like to know how to identify if a cell's contents meets certain requirements. Specifically I want to determine if there is Credit Card information in a given cell. The information in a given cell is written free hand and in no certain order. The following string patterns should trigger the code to indicate that there is cc info in the cell.

    A "#" is equivalent to any integer.

    #### #### #### ####
    cvv
    ################
    ####-####-####-####

    I've only gotten as far as to think that i may need to enter all of the characters into an array and do something from there. So basically I just want to be able to look through a paragraph of writing in a cell and determine if it has any of the above patterns within.
    Last edited by TYork; 08-17-2010 at 08:58 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: String manipulation and pattern recognition

    See VBE Help for the Like operator.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: String manipulation and pattern recognition

    If you're looking to use formulae the below:

    =SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(A1,{0,1,2,3,4,5,6,7,8,9},"")))=16

    will tell you if there are 16 digits in the string

  4. #4
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: String manipulation and pattern recognition

    The like operator takes care of it, thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1