Results 1 to 2 of 2
  1. #1
    Swarles_Barkley is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    1

    Getting data from rows to columns based on common fields.

    I have a big Excel file with payroll information about employees. Per employee per date, there are a couple of rows with mostly identical data (such as the employee's home address) but 2 differences: one will have paycode A with amount B, another will have paycode C with amount D, etc. I want to simplify the file to have 1 row per employee per date: in the example given that row would have paycode A with amount B as well as paycode C with amount D, in 4 separate columns.



    I think I can technically solve this by creating Excel files per pay code/amount, and then linking them together by person and date, 1 by 1, through Access. This is feasible because there aren't that many different pay codes. But still, I was wondering if there was anyway to solve my problem in Access itself.

    Thanks.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Yes, create a new query with Employee Name, Date, and then four calculated fields, the first of which will look like this:
    Code:
    Amount_A:IIF([PayCode]="A",[Amount],0)
    repeat for codes B-D.

    Then, you van do an Aggregate Query on this, Grouping by your Name and Date fields, and Summing all four calculated fields. This will collapse the records down to a single row for each Name/Date combination.

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

Similar Threads

  1. the cells that some rows have in common
    By analarana in forum Access
    Replies: 3
    Last Post: 06-11-2013, 02:33 PM
  2. Replies: 6
    Last Post: 05-09-2013, 11:00 PM
  3. Combine datatable rows based in common value
    By pipelian in forum Access
    Replies: 1
    Last Post: 11-27-2012, 10:20 AM
  4. Query to transpose Data in Columns to Rows
    By ace1259 in forum Access
    Replies: 2
    Last Post: 04-10-2012, 01:49 PM
  5. Replies: 5
    Last Post: 03-29-2012, 09:21 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