Results 1 to 3 of 3
  1. #1
    Alwyn is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Location
    Cape Town
    Posts
    1

    How to "Transpose" data in Access

    Hi All



    The title is not very descriptive of what I want to achieve, I think an example will be more useful.

    I have data that looks as follows:

    Product Scenario 1 Scenario 2 Scenario 3
    A Value 1 Value 1 Value 1
    B Value 2 Value 2 Value 2
    C Value 3 Value 3 Value 3

    I need the data in the following format:


    Product Scenario Scenario Value
    A 1 Value 1
    A 2 Value 1
    A 3 Value 1
    B 1 Value 2
    B 2 Value 2
    B 3 Value 2
    C 1 Value 3
    C 2 Value 3
    C 3 Value 3

    If anyone knows how I can do this it would be greatly appreciated!

    Regards
    Alwyn

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    use a union query - you'll need one for each scenario. Your outcome is how the data should be stored in the first place

  3. #3
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    Code:
    SELECT Product, "1" AS Scenario, [Scenario 1] FROM TableName
    UNION ALL
    SELECT Product, "2" AS Scenario, [Scenario 2] FROM TableName
    UNION ALL
    SELECT Product, "3" AS Scenario, [Scenario 3] FROM TableName
    ORDER BY Product, Scenario

    Product Scenario Scenario 1
    A 1 Value 1
    A 2 Value 1
    A 3 Value 1
    B 1 Value 2
    B 2 Value 2
    B 3 Value 2
    C 1 Value 3
    C 2 Value 3
    C 3 Value 3

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

Similar Threads

  1. Replies: 13
    Last Post: 12-12-2016, 12:26 AM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  4. Replies: 1
    Last Post: 08-23-2012, 08:32 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