Good morning,
I'm a trainee at a recently new job, and started to study VBA as a solution for my work. I managed to create some simple coding for some tasks, but this seems too complex for me
I have a database that I must analyse the accuracy of the data we collect, and I think I can gain lots of time if I manage to highlight with RGB color the phone entries, based on the lenght and the entry formatting
For example, very often, cellphone numbers (which contains 1 extra number "9" in front of the number set) are inserted in the residential number field, therefore I could identify them simply looking this extra number:
Residential e.g: (11)4557-9086
Mobile e.g: (11)95667-3567
The problem is that I also make a parallel analysis, wether the number has it's local code or not ("(11)"), and considering the mobile numbers, I would collor the cell as a "wrong field" entry, hierarchically, although it's also a "no local code" entry.
So for instance:
1. (11)97554-6899 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number
2. (11)98644-5482 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number
3. (11)4556-3287 ---> RGB(198, 239, 206) - Correct Field, as it has the local code and has no "9" sufix and therefore is a residential number
4. 4312-8990 ---> RGB(255, 235, 156) - No Local Code, as it is a residential number for not having the "9" sufix, but it does not carry the local code
5. 95567-1234 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number (although it also does not carry the local code, hierarchically, I will ignore this fact)
6. 94879-0045 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number (although it also does not carry the local code, hierarchically, I will ignore this fact)
7. (11)2345-9878 ---> RGB(198, 239, 206) - Correct Field, as it has the local code and has no "9" sufix and therefore is a residential number
8. 5678-9834 ---> RGB(255, 235, 156) - No Local Code, as it is a residential number for not having the "9" sufix, but it does not carry the local code
9. 94456-1264 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number (although it also does not carry the local code, hierarchically, I will ignore this fact)
10. (11)96789-0678 ---> RGB(242, 242, 242) - Wrong Field, as it has a "9" sufix after the local code and cannot be a residential number
As for 2 last rules, all mobile numbers obligatorily contain a "9" sufix, and it cannot be any other number, and there's a minimum/maximum total of numbers, so if the macro comes across something like:
1. (11)79560-4567 ---> RGB(255, 199, 206) - Error Entry, as the sufix in this case is "7" and not "9" (hierarchically, I will considerer errors above Wrong Field entries, as this entry is also supposed to be in the mobile field)
2. (11)45567-9844 ---> RGB(255, 199, 206) - Error Entry, as the sufix in this case is "7" and not "9" (hierarchically, I will considerer errors above Wrong Field entries, as this entry is also supposed to be in the mobile field)
3. 8554560-2366 ---> RGB(255, 199, 206) - Error Entry, as the number is too BIG to be either a residential or a mobile number
4. 233448-5295 ---> RGB(255, 199, 206) - Error Entry, as the number is too BIG to be either a residential or a mobile number
5. 156-3456 ---> RGB(255, 199, 206) - Error Entry, as the number is too SHORT to be either a residential or a mobile number
The action should only change the cell interior collor, there's no need for replacing the data inside it. If some excel wizard and beloved human could help me on this I'd be forever thankful. I have to go through a list of 150000 registries and been doing that using filter and sorting (it feels like dying), this would save me weeks, even months.
I have tried creating some codes, merging things I find in the internet, but it just too complex for my actual knowledge as it carries hierarchy and stuff, so I'm sorry for not giving a start kick or something
PS: The data is set on column M
Bookmarks