Results 1 to 5 of 5
  1. #1
    davidgoliath is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3

    Creating multiple, sequential crosstab-esque columns from one field.

    Hi all -

    This is probably a simple question for some.

    I have data that looks like this:

    Number of Operators per Permit
    Permit Operator Name
    6
    065-24088 EOG RESOURCES INC
    6 065-24088 PDC MOUNTAINEER LLC
    6 065-24088 PETRO DEV CORP
    6 065-24088 PETROLEUM DEV CO
    6 065-24088 SOMERSET OIL & GAS CO INC
    6 065-24088 EXCO RESOURCES PA INC
    6
    063-27221 LINN OPR LLC
    6 063-27221 MTN V OIL & GAS INC
    6 063-27221
    LINN OPR INC
    6
    063-27221 DOMINION EXPLORATION & PROD INC
    6 063-27221 CONSOL GAS CO
    6 063-27221 CNX GAS CO LLC
    5
    129-24355 REX ENERGY OPERATING CORPORATION
    5 129-24355 DOUGLAS OIL & GAS LP
    5
    129-24355 REX ENERGY OPERATING CORP
    5 129-24355 STD STEEL
    5 129-24355 STD STEEL LLC

    I want to take this data and create six new columns (operator1; operator2; operator3; operator4; operator5; operator6) for each permit number so that each unique operator name will be housed in each of those six columns, with the rows being defined by the permit number. So, I want to produce something that looks like this...



    Permit
    operator1 operator2 operator3 operator4 operator5 operator6
    065-24088
    EOG RESOURCES INC PDC MOUNTAINEER LLC PETRO DEV CORP PETROLEUM DEV CO SOMERSET OIL & GAS CO INC EXCO RESOURCES PA INC
    063-27221
    LINN OPR LLC MTN V OIL & GAS INC LINN OPR INC DOMINION EXPLORATION & PROD INC CONSOL GAS CO CNX GAS CO LLC
    129-24355
    REX ENERGY OPERATING CORPORATION DOUGLAS OIL & GAS LP REX ENERGY OPERATING CORP STD STEEL STD STEEL LLC

    At present, there are as many as 6 operators per permit, but the number of operators per permit varies from 1 to 6. I included an example that has 5 operators, to show that I want the sixth column to be null in this instance. So if a permit had only one operator, only the operator1 field would take on a non-null value in the new table/query.

    I know how to do this with 2 operators per permit by using min/max or first/last functions in a query, but I don't know how to deal with more than two operators per permit.

    Figuring this out would really help with my analyses, so any tips will be much appreciated!

    Thanks!

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    If you are able to change the field "Number of Operators...." to Operators and number them one up for each permit then you could do something like what is shown in this video

    http://www.datapigtechnologies.com/f.../crosstab.html

  3. #3
    davidgoliath is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3
    Hmm... yeah, that would work.

    I'll have to dig on an efficient way to create sequential numbers based on the permits...

    Thanks.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Sequential numbering by group can be done by:

    1. manually enter the next number

    2. VBA code to determine next available number for group and save value to table. This is a common topic in forum.
    https://www.accessforums.net/access/...ers-15787.html
    https://www.accessforums.net/forms/a...ing-23329.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.

  5. #5
    davidgoliath is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3
    Thanks June7 and alansidman. I did the sequential numbering in Excel rather clunkily, but effectively. Snap after that.

    =) Gavid Doliath

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

Similar Threads

  1. Replies: 10
    Last Post: 03-01-2012, 11:31 PM
  2. Multiple columns from 1 query field
    By top1hat19 in forum Queries
    Replies: 3
    Last Post: 03-11-2011, 03:03 PM
  3. Replies: 1
    Last Post: 02-05-2010, 08:33 AM
  4. Replies: 3
    Last Post: 10-18-2009, 08:38 PM
  5. Replies: 1
    Last Post: 01-31-2009, 10:43 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