Results 1 to 15 of 15

Macro to Transpose Data

Threaded View

  1. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Transpose Data onto New Sheet

    As Ali indicated. A fairly simple task for Power Query. Mcode:

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Customer Location.", Int64.Type}, {"Plant Desc.", type text}, {"Product", Int64.Type}, {"Prod.Desc.", type text}, {"Unit of Measure", type text}, {"Deliv. Date", type date}, {"Document Qty.", Int64.Type}}),
        #"Inserted Start of Month" = Table.AddColumn(#"Changed Type", "Start of Month", each Date.StartOfMonth([Deliv. Date]), type date),
        #"Removed Columns" = Table.RemoveColumns(#"Inserted Start of Month",{"Deliv. Date"}),
        #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Start of Month", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Start of Month", type text}}, "en-US")[#"Start of Month"]), "Start of Month", "Document Qty.")
    in
        #"Pivoted Column"
    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    Customer Location. Plant Desc. Product Prod.Desc. Unit of Measure 12/1/2020 1/1/2020 2/1/2020 6/1/2021 1/1/2021 2/1/2021
    2
    11111
    Customer - 1
    1075176
    Product Description KG
    50
    3
    11111
    Customer - 1
    10046903
    Product Description KG
    50
    534
    890
    4
    22222
    Customer - 2
    10045134
    Product Description KG
    174
    1234
    806
    5
    22222
    Customer - 2
    10049999
    Product Description KG
    25
    Sheet: Table1

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Need VBA Macro to transpose data
    By vbronton in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-03-2019, 09:17 AM
  2. Transpose data macro
    By makinmomb in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-11-2015, 05:16 PM
  3. [SOLVED] Transpose Data Using Macro
    By Jbrowning1980 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-25-2015, 12:57 PM
  4. [SOLVED] macro to transpose data
    By rhoda20 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2014, 08:39 AM
  5. [SOLVED] Macro To Transpose Data
    By AlexRoberts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2014, 09:33 AM
  6. Help with macro to transpose data
    By ejecheche in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2012, 06:26 AM
  7. Transpose Data Macro
    By Jakila2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2011, 03:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1