Results 1 to 3 of 3
  1. #1
    Algal100 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    1

    Trying to create Access query that will mimic an existing Excel spreadsheet

    Hi,



    I am a novice Access user and not a programmer so I think this should be [I hope] an easy one! I have a very simple Excel spreadsheet that contains 2 formulas. I'd like to be able to generate the table in Access directly (instead of using Excel, then uploading or linking a table).

    I have a list of companies and employee names (2 columns). The goal is to be able to have a cell that concatenates all the employees at the same company, separated by a comma, and a unique list of companies. Right now I use Excel....sort the spreadsheet by Company, put in the following formulas, then delete any rows where the cell in the "Last" column is blank:
    [cell C2]: Name(s) = =IF(A2=A1,C1&", "&B2,B2)
    [cell D2]: Last = =IF(A2<>A3,"Last","")
    The result is being left with unique Company rows and the names of all the employees in one cell.

    In the example below, there is one employee at Target and 2 at General Electric. Ultimately, I'd like to only see rows 1 and 3. Is there any way to program this in Access? Or some other crafty way to get the results I'm looking for? Thank you in advance!!
    Company Name Name(s) Last
    Target John Smith John Smith Last
    General Electric Amy Adams Amy Adams
    General Electric Ed Miller Amy Adams, Ed Miller Last

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Need VBA code. Review http://allenbrowne.com/func-concat.html

    Rather common topic. Here is one recent thread https://www.accessforums.net/access/...hip-50216.html
    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
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    concatenates is very easy is query. You can use Distinct command to get only unique data

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

Similar Threads

  1. Replies: 1
    Last Post: 02-02-2015, 04:08 PM
  2. Importing Excel spreadsheet and appending it to an existing table
    By Access_Novice in forum Database Design
    Replies: 3
    Last Post: 08-21-2014, 07:01 AM
  3. Macro to mimic Import & Link Excel button on external data
    By arnstrb in forum Import/Export Data
    Replies: 1
    Last Post: 03-16-2014, 07:52 PM
  4. Replies: 1
    Last Post: 08-05-2013, 03:47 PM
  5. Replies: 2
    Last Post: 01-28-2013, 08:59 PM

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