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![]()
Bookmarks