Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:51:08+00:00 2026-06-01T19:51:08+00:00

I have a table exported from Access database via SQL query. In excel, there

  • 0

I have a table exported from Access database via SQL query. In excel, there are 3 columns: ID, name and a phone number… The problematic is a phone number column. Users have put in numbers in all kinds of ways so it looks very untidy and i cant use that field for other purposes.

Lets say that the default way that i want to see the numbers is: 385991234567. So it has the country code, than the area code, then the number… but all together combined.

In the database i have inputs like:

0991234567 – so without the country code

991234567 – without the country code and the leading zero of the area code

+385991234567 – with + in front of the country code

99/1234-567 – with various character separating the groups of numbers (i’ve managed to clean that up through the replace in the sql query).

The thing i want is to achieve the format i mentioned in the beginning. so add the country code, if needed remove the leading zero. The additional problem is that some of the numbers are 7 digits, others are 6 digits (without the country or area codes). Ive tried to do the replace by searching the 099 for instance, but if it occurs in the middle of the number, it gets changed too.

I dont know what to do. Or even is this the right section for this question (because i dont know if it is easier to do it in excel, via VBA macro, via sql query or something else). I cant do it by hand because its a field of approx. 100.000 phone numbers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:51:09+00:00Added an answer on June 1, 2026 at 7:51 pm

    OK, so here it is… for starters, i used some SQL Queries to select the specific phone numbers and clean up the junk characters from phone numbers…

    select sk, name1, phone into telefoni from 
    (
    SELECT customer_id as sk, name as NAME1, phone1 as phone from customers where len    (phone1)>7 and (phone1 like "09*" or phone1 like "3859*" or phone1 like "*3859*" or phone1 like "95*" or phone1 like "98*" or phone1 like "99*" or phone1 like "91*" or phone1 like "92*" or phone1 like "97*")
    

    and this one…

    SELECT distinct sk, name1, replace(replace(replace(replace(replace(phone, "/", ""), "-", ""), " ", ""), ".", ""), "*", "") as tel into telefoni2 from telefoni1 order by name1;
    

    After that, i exported the data to excel and applied the next macro…

    Sub test()
    For Each cell In Selection
        If cell.Value Like "091*" Then cell.Value = Replace(cell.Value, "091", "38591", 1, 1, vbTextCompare)
        Next cell
    End Sub
    

    And thats about it… worked like a charm. The code may be messy or could be written better, but i am a novice, so i guess its ok 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table in data base name train delay, with columns train number(int), DelayTime(int),
I exported some data from my database table into sql file as insert statements.
I have exported a schema from one Oracle database using SQL Developer (tools ->
I have exported many times tables from Hive to SQL Server. I never face
I exported a database schema from one server using SQL Developer (Tools-> Database Export).
I have csv file exported from access. (dates formatted to match mysql) I need
I have a large (multi-GB) data file exported from an Oracle table. I want
I have an asp:table which I want to exported to excel. One of my
I have table with 50 entries (users with such details like Name Surname Location
I have table rows of data in html being filled from a CGI application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.