Results 1 to 4 of 4
  1. #1
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501

    Find duplicates and move phone number to phone2

    I have a table that has a bunch of user names and emails. If the user has two emails then it shows them twice in the query. What is the best way with access/excel combo to get it to where will show the user once and put the phone number in cells like phone1 and phone2 etc.

    I have tried a find duplicates query and that at least gives me all the users that have more than one phone but I have over 8k of them so I don't know any easy way to get it to one user with each email in a separate column.

    Any help or ideas is appreciated.
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Maybe a CROSSTAB query which would probably use DCount() domain aggregate function. Provide sample data as a table in post or attach db.

    Or use VBA to concatenate phone numbers to a single string of data.

    What do you mean by 'each email in a separate column' - the entire email message?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    One possibility based on 'email' meaning email address - "user" details in main form, except perhaps email address and phone numbers. Then subform as datasheet or continuous, one record for each email. If there are 2 addresses and one phone, one phone field is blank in one of the records.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    Hey guys,
    yes, email means email address. A bunch of users with the same email address have multiple phone numbers.

    I ended up doing this with a several step method. I am sure there are better ways to do it but it worked and didn't take too long.
    -Sort by email address
    -Use countifs to get how many phone numbers each user/email has associated with it
    -Copy and paste all the user/email with only 1 phone number to a new sheet and import that
    -Copy and paste all the user/email with 2 phone numbers to a new sheet
    -Use an if statement to label them as first or second
    -Sort by label and then cut all the second and paste them in a new range next to the first ones. Then i can just delete the extra columns and I end up with FirstName, LastName, Email, Phone1/Phone2
    -For the users with three emails I used an if statement to get the first and second ( like I did with the ones with two) and then in the column next to that I used an =if(And to label it as the third.
    -Next I used concatenate to end up getting a single column that said First, Second, or SecondThird.
    -next I did like before and sorted, cut, paste and remove unnecessary cells.

    It actually worked pretty well and was pretty quick overall.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. format UK Phone number
    By sdel_nevo in forum Programming
    Replies: 5
    Last Post: 03-12-2016, 12:29 PM
  2. Replies: 3
    Last Post: 01-18-2016, 01:55 PM
  3. Replies: 5
    Last Post: 04-24-2012, 10:26 AM
  4. Phone number format
    By ManvinderKaur in forum Access
    Replies: 1
    Last Post: 06-24-2010, 08:07 AM
  5. Phone number in (000) 000-0000
    By Ajay in forum Queries
    Replies: 9
    Last Post: 03-12-2010, 11:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums