+ Reply to Thread
Results 1 to 6 of 6

Looking for Macro to searc for a SSN

  1. #1
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Looking for Macro to searc for a SSN

    I am trying to figure out how to search for a Social Security Number formatted a specific way in a large spreadsheet. The number could be anywhere. Could be in a collumn by itself or embedded in text in a column.

    Need something to look for the following format ###-##-#### where # could be any number and there will always be two dashes.

    Just need to find them and display the cell location.

    Any ideas on how to do this.

    Thanks

  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: Looking for Macro to searc for a SSN

    Search for *-*-*

    It won't be found in text buried deeper that 1024 characters.
    Last edited by shg; 02-15-2011 at 05:18 PM. Reason: correction
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Looking for Macro to searc for a SSN

    This gives me tons of false positives. Example: Illness-Scratch-Eye, 02-15-2011.

    I need something that looks for ###-##-### where # is only numbers meets that pattern.

  4. #4
    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: Looking for Macro to searc for a SSN

    Then you'd have to so something like a RegExp search in MoreFunc.

  5. #5
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Looking for Macro to searc for a SSN

    Not familier with that. Was hoping for an example macro or vba.
    thanks

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

    Re: Looking for Macro to searc for a SSN

    Quote Originally Posted by bbrad
    Need something to look for the following format ###-##-#### where # could be any number and there will always be two dashes.
    It's not clear if by "any number" you mean any length or simply any digit

    Assuming the latter (ie 3 digit - 2 digit - 4 digit):

    What happens if you search for

    ???-??-????

    Do you still get false positives ?

    If you do, given the data can appear anywhere it would be worth either:

    a) running an iterative Search based on the above until such time as a match is found

    or

    b) populating an Array with the UsedRange and iterating the Array for a match

    I suspect b) would be quicker.

    A sample file might help - obviously dummy the SSN but try to make the example(s) an accurate reflection of the data you have to work with.
    Last edited by DonkeyOte; 02-16-2011 at 03:59 AM. Reason: typo in narrative

+ 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