+ Reply to Thread
Results 1 to 13 of 13

Advanced form of transposing data from column to row

  1. #1
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Advanced form of transposing data from column to row

    I have a list of contacts. Each row contains the company name and associated information then the name and information about the first executive, then the 2nd executive, etc. some records in the actual data set can have up to 7 executives.

    I want to reorganize it so that each executive is in its own row. So, in the 2nd row, the company information needs to be copied down then executive 2 needs to be listed. In the 3rd row the company information needs to be copied down and then executive 3 etc.

    My original data set has 765 rows (companies).

    I've attached a sample excel workbook (with fake data) with what my original data looks like (tab 1) and what my final data needs to look like (tab 2).

    Any help would be appreciated.


    Sample-Data-Set-Shailesh.xlsm

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Advanced form of transposing data from column to row

    With Power Query

    Please Login or Register  to view this content.
    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.

    Excel 2016 (Windows) 64 bit
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    Company ID Company Name Address Zip City State Company Email Value First Name Last Name Title
    2
    1
    Acme 12345 E Main
    84009
    Ceder City OH [email protected]
    1253648
    Bob Willis CEO / President
    3
    1
    Acme 12345 E Main
    84009
    Ceder City OH [email protected]
    452365
    Travis Jones VP Sales
    4
    1
    Acme 12345 E Main
    84009
    Ceder City OH [email protected]
    5623652
    Troy Yong Marketing Manager
    5
    2
    Baloon 2418 E Wave
    95006
    Melbourne WI [email protected]
    3654123
    Jack Harrison President
    6
    2
    Baloon 2418 E Wave
    95006
    Melbourne WI [email protected]
    452136
    Melanie Holmes Marketing
    7
    2
    Baloon 2418 E Wave
    95006
    Melbourne WI [email protected]
    5896523
    Melissa Beckenberg Operations Manager
    8
    3
    Alta Vista 34 E Code
    75632
    S. Mountain MI [email protected]
    1253640
    Mark Jones V.P. Sales
    9
    3
    Alta Vista 34 E Code
    75632
    S. Mountain MI [email protected]
    125632
    Terry Rodgers Controller
    10
    3
    Alta Vista 34 E Code
    75632
    S. Mountain MI [email protected]
    7652365
    Joni Warner Sales Director
    11
    4
    Zantas 348 W Maven
    68523
    Los Alamos AZ [email protected]
    1258300
    Mathew Ash Sales Director
    12
    4
    Zantas 348 W Maven
    68523
    Los Alamos AZ [email protected]
    125836
    Beverly Rodrigues Sales Director
    13
    4
    Zantas 348 W Maven
    68523
    Los Alamos AZ [email protected]
    8523654
    Carrie Smith Operations Manager
    14
    5
    TechFarm 2349 NE 49th St.
    43520
    Madison AK [email protected]
    1254125
    John Mellencamp CEO / President
    15
    5
    TechFarm 2349 NE 49th St.
    43520
    Madison AK [email protected]
    786250
    Bertha Maher VP Marketing
    16
    5
    TechFarm 2349 NE 49th St.
    43520
    Madison AK [email protected]
    1253642
    Shannon Webb Marketing Manager
    Sheet: Table1
    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

  3. #3
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    Thank you for this. Looks like it is the exact solution. However, it keeps giving me this error even though my tab is named Table1

    Expression.Error: We couldn't find an Excel table named 'Table1'.
    Details:
    Table1

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Advanced form of transposing data from column to row

    Double check that there is no space between Table and 1.

  5. #5
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    Quote Originally Posted by alansidman View Post
    Double check that there is no space between Table and 1.
    I checked. Even renamed to a single word. Didn't work. Is there a setting in my local setup that I need to consider? Macros enabled/disabled etc.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Advanced form of transposing data from column to row

    I am a loss. Can you provide a revised sample of your data as the sample provided works for me as you can see in the file I attached in post #2

  7. #7
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    Here you go. I've uploaded a copy of the original sample file.

    2-Sample-Data-Set-Shailesh - revised.xlsm

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Advanced form of transposing data from column to row

    Ran code on new sheet. No issues. Same result as shown in earlier Post. Suggest you name your table before importing to PQ. Highlight the range of data and click on Ctl +T. Then edit the name to what you deem appropriate and change the name in the Mcode.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Advanced form of transposing data from column to row

    Assuming 2211 is O365, V2211... then an all-in-one-cell formula can do that, too.

    Delete ALL expected results.

    In A2:
    =LET(A,DummyTable!A2:G6,B,DummyTable!H2:S6,C,TEXTSPLIT(CONCAT(REPT(BYROW(A,LAMBDA(x,TEXTJOIN("",,x)))&",",3)),"",",",1),D,WRAPROWS(TOCOL(B,,FALSE),4),HSTACK(C,D))

    Adjust the bits in red to suit your real data.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  10. #10
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    This worked. Thank you!

  11. #11
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    Quote Originally Posted by alansidman View Post
    Ran code on new sheet. No issues. Same result as shown in earlier Post. Suggest you name your table before importing to PQ. Highlight the range of data and click on Ctl +T. Then edit the name to what you deem appropriate and change the name in the Mcode.
    This worked thank you!!!!

  12. #12
    Registered User
    Join Date
    01-18-2023
    Location
    SLC, UT
    MS-Off Ver
    v 2211 Build 15831
    Posts
    7

    Re: Advanced form of transposing data from column to row

    Quote Originally Posted by Glenn Kennedy View Post
    Assuming 2211 is O365, V2211... then an all-in-one-cell formula can do that, too.

    Delete ALL expected results.

    In A2:
    =LET(A,DummyTable!A2:G6,B,DummyTable!H2:S6,C,TEXTSPLIT(CONCAT(REPT(BYROW(A,LAMBDA(x,TEXTJOIN("",,x)))&",",3)),"",",",1),D,WRAPROWS(TOCOL(B,,FALSE),4),HSTACK(C,D))

    Adjust the bits in red to suit your real data.
    The other solution worked, but I'll give this a try a well. Thank you.

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Advanced form of transposing data from column to row

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Advanced transposing of data
    By Exc3lnoob in forum Excel General
    Replies: 10
    Last Post: 04-16-2018, 03:39 PM
  2. Advanced Transposing
    By EdwardSnowden in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-27-2018, 04:42 PM
  3. Advanced data transposing
    By heidilaw4 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-20-2013, 03:06 AM
  4. [SOLVED] Advanced Variable Transposing
    By ian.clark in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-08-2013, 03:16 AM
  5. Replies: 4
    Last Post: 10-31-2011, 04:33 PM
  6. Help needed for advanced transposing
    By ncikusa in forum Excel General
    Replies: 3
    Last Post: 03-09-2011, 03:47 AM
  7. Advanced Transposing?
    By SHexceluser in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-12-2005, 11:05 AM

Tags for this Thread

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