+ Reply to Thread
Results 1 to 9 of 9

Is there a formula or automated way to restructure and stack columns as shown in the image

  1. #1
    Registered User
    Join Date
    08-01-2023
    Location
    NC
    MS-Off Ver
    365
    Posts
    4

    Is there a formula or automated way to restructure and stack columns as shown in the image

    I am looking for an automated way to go from the example table on the left to the example table on the right. The only thing I can currently think of is to do it manually but this would take hours based on the size of the worksheet. If this is possible please steer me in the right direction.

    Current Table Left | Desired Table Right

    Example.png

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Assuming your data occupies cells A2:C11, with row 1 for the headers, you can use these formulae in the cells stated:

    E2: =INT((ROWS($1:1)-1)/2)+1

    F2: =INDEX($B$1:$C$1,MOD(ROWS($1:1)-1,2)+1)

    G2: =INDEX($B$2:$C$11,INT((ROWS($1:1)-1)/2)+1,MOD(ROWS($1:1)-1,2)+1)

    Copy the 3 formulae down as far as you need to.

    Hope this helps.

    Pete

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Or try for the whole table inclusive the header in one go in a single-cell formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 08-01-2023 at 09:49 PM.

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Another option,

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-01-2023
    Location
    NC
    MS-Off Ver
    365
    Posts
    4

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Thank you! This worked perfectly for what I need!

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    You are welcome.
    --------------------------------------
    If that takes care of your original question, please click on "Thread Tools" from the menu link above and mark this thread as SOLVED.

  7. #7
    Registered User
    Join Date
    08-01-2023
    Location
    NC
    MS-Off Ver
    365
    Posts
    4

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Could you adjust this formula to add a fourth column of data? Formula Test.xlsx

    In this spreadsheet I have my current test data on the left and my desired end state on the right.

    Thank you!!
    Last edited by AliGW; 08-06-2023 at 12:33 AM. Reason: Please do NOT quote unnecessarily!

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Try this,

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-01-2023
    Location
    NC
    MS-Off Ver
    365
    Posts
    4

    Re: Is there a formula or automated way to restructure and stack columns as shown in the i

    Perfection! Thanks again!
    Last edited by AliGW; 08-06-2023 at 12:33 AM. Reason: Please do NOT quote unnecessarily!

+ 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. columns calculated to a shown formula
    By sven1234 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-10-2023, 02:39 AM
  2. Shown image in HTML email BODY through CDO
    By Shiroi14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2021, 10:29 AM
  3. Replies: 5
    Last Post: 03-21-2017, 05:09 AM
  4. Replies: 0
    Last Post: 07-30-2015, 05:50 PM
  5. Restructure data into columns
    By refuelled in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2013, 08:18 AM
  6. Need excel help with this kind of calculation as in shown image
    By samj221 in forum Excel Formulas & Functions
    Replies: 50
    Last Post: 09-04-2012, 11:30 AM
  7. How do i make relative path for image to be shown on multipage?
    By Lkivagten in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-10-2012, 09:36 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