+ Reply to Thread
Results 1 to 8 of 8

Filter & remove incorrectly formatted mobile numbers

  1. #1
    Registered User
    Join Date
    03-06-2015
    Location
    London, England
    MS-Off Ver
    2014
    Posts
    9

    Filter & remove incorrectly formatted mobile numbers

    Hi Excel wizards

    I have a sheet with a long list of UK mobile numbers, a fair percentage of which are incorrectly formatted due to people entering them incorrect when registering. I currently use basic filtering to arrange them then manually delete those that are incorrect but it's quite time consuming and I'm sure there must be an easier way but I don't know how to use VBA too well, which I imagine is what's needed to do this automatically and hopefully in one sweep.

    What I'd ideally like is a piece of code, or formula, that;

    A) Searches the whole column for all numbers starting with either 447 or 7 then;
    B) If string starts with 44, does the it contain 12 digits? If string starts with 7, does it contain 10 digits?, if yes then;
    C) Add "44" to all 10 digit numbers. then;
    D) Delete all other rows from the sheet and leave only rows with correctly formatted numbers (447999999999)

    I've attached an example, the raw data being in column A/B and the desired result in column D/E.

    PhoneNumbers.xlsx

    Please note, the sheet attached is not how it might always be and just provided as an example. The number of rows are in the 100s/1000s and the number of columns can vary between 10 and 30 (these contain varying customer attributes depending on project). I don't want to edit anything else, just remove all rows with incorrect numbers.

    I hope that makes sense, and is possible because it'd make my life so much easier. Thanks for your help with this

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Filter & remove incorrectly formatted mobile numbers

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Filter & remove incorrectly formatted mobile numbers

    Slightly different approach, I was having problems with the number formatting:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Filter & remove incorrectly formatted mobile numbers

    Well we can design something to help you do what you want, but it might be a bit complicated or difficult for you to audit, so I am going to recommend you record a macro doing what you want then ask us for help modifying it to be dynamic.

    Will that get you headed in the correct direction?
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  5. #5
    Registered User
    Join Date
    03-06-2015
    Location
    London, England
    MS-Off Ver
    2014
    Posts
    9

    Re: Filter & remove incorrectly formatted mobile numbers

    Hi. Thanks for the quick response.

    I'll give that code a go and let you know, if not then I'll record the macro and get back to you.

    Thanks

  6. #6
    Registered User
    Join Date
    03-06-2015
    Location
    London, England
    MS-Off Ver
    2014
    Posts
    9

    Re: Filter & remove incorrectly formatted mobile numbers

    Hi stnkynts. That's perfect, it works and does exactly what I asked for. However, I've just realised a couple of other cases and would like to add an extra step or two, if possible please?

    1) I've noticed that some of the incorrectly formatted ones are almost correct but they're like this "4407999999999". So what I need for this is to identify those cells beginning with 4407, and with a length of 13 and basically remove the 0 leaving "447" and a length of 12 like the rest.

    2) Some contain spaces (1 or 2) but are correct otherwise, with a mixture of "4407" and "447" prefixes like the case above and the original request. Is there a way of identifying these and remove the spaces? Then for the 4407 ones to remove the 0 as above? Assuming again that what I'm left with is a 12 digit number that starts with "447", any other length should delete the row.

    Examples for case 2: "4407999 999999", "4407999 999 999" & "447999 999999", "447999 999 999"

    If that can be done then you've absolutely nailed it for me! This is greatly appreciated, thank you.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Filter & remove incorrectly formatted mobile numbers

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-06-2015
    Location
    London, England
    MS-Off Ver
    2014
    Posts
    9

    Re: Filter & remove incorrectly formatted mobile numbers

    Lovely, that seems to do the trick. This will save me loads of time and a big headache at the end of it

    Thank you stnkynts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Is it possible to use the filter function in Google Docs through Android mobile phone?
    By otterandrews in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 08-14-2014, 03:00 AM
  2. Incorrectly formatted numbers
    By mikecook in forum Excel General
    Replies: 3
    Last Post: 06-02-2010, 08:37 AM
  3. Uk Mobile Telephone Numbers
    By Badvgood in forum Excel General
    Replies: 1
    Last Post: 05-13-2010, 12:54 PM
  4. 0 on mobile numbers
    By shazemmo in forum Excel General
    Replies: 1
    Last Post: 06-07-2006, 09:10 PM
  5. mobile phones numbers
    By sparky in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2005, 12:06 AM

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