+ Reply to Thread
Results 1 to 6 of 6

Convert multiple rows of horizontal data into three rows of vertical data

  1. #1
    Registered User
    Join Date
    05-07-2015
    Location
    here
    MS-Off Ver
    '11
    Posts
    3

    Convert multiple rows of horizontal data into three rows of vertical data

    Hello - Long time stalker, first time poster. I've got an issue concerning over 30,000 items that I can't research and figure out simply because I can't explain it.

    I need to convert this:

    A B C D E F G H I J K
    1 SKU ITEM1 QTY1 ITEM2 QTY2 ITEM3 QTY3 ITEM4 QTY4 ITEM5 QTY5
    2 01CNBP208B1B1 BTCNBP208D01 1
    3 01CNBP208B2B1 BTCNBP208D01 2
    4 01CNBP208B3B1 BTCNBP208D01 3
    5 01CNBP208B4B1 BTCNBP208D01 4
    6 01CNBP208BC1B1 BTCNBP208D01 1 CHCNBP208D01 1
    7 01CNBP208BC2B1 BTCNBP208D01 2 CHCNBP208D01 1
    8 01CNBP208KB1B1 BTCNBP208D01 1 LCK5 1 MEMCASE 1 CRSD 1
    9 01CNBP208KB2B1 BTCNBP208D01 2 LCK5 1 MEMCASE 1 CRSD 1
    10 01CNBP208KB3B1 BTCNBP208D01 3 LCK5 1 MEMCASE 1 CRSD 1
    11 01CNBP208KB4B1 BTCNBP208D01 4 LCK5 1 MEMCASE 1 CRSD 1
    12 01CNBP208KBC1B1 BTCNBP208D01 1 CHCNBP208D01 1 LCK5 1 MEMCASE 1 CRSD 1
    13 01CNBP208KBC2B1 BTCNBP208D01 2 CHCNBP208D01 1 LCK5 1 MEMCASE 1 CRSD 1
    14 01CNBP208KBC3B1 BTCNBP208D01 3 CHCNBP208D01 1 LCK5 1 MEMCASE 1 CRSD 1

    Into this:
    A B C
    1 SKU ITEM QTY
    2 01CNBP208B1B1 BTCNBP208D01 1
    3 01CNBP208B2B1 BTCNBP208D01 2
    4 01CNBP208B3B1 BTCNBP208D01 3
    5 01CNBP208B4B1 BTCNBP208D01 4
    6 01CNBP208BC1B1 BTCNBP208D01 1
    7 01CNBP208BC1B1 CHCNBP208D01 1
    8 01CNBP208BC2B1 BTCNBP208D01 2
    9 01CNBP208BC2B1 CHCNBP208D01 1
    10 01CNBP208BC3B1 BTCNBP208D01 3
    11 01CNBP208BC3B1 CHCNBP208D01 1
    12 01CNBP208BC4B1 BTCNBP208D01 4
    13 01CNBP208BC4B1 CHCNBP208D01 1
    14 01CNBP208C1B1 CHCNBP208D01 1
    151 01CNBP208KB1B1 BTCNBP208D01 1
    16 01CNBP208KB1B1 LCK5 1
    17 01CNBP208KB1B1 MEMCASE 1
    18 01CNBP208KB1B1 CRSD 1
    19 01CNBP208KB2B1 BTCNBP208D01 2
    20 01CNBP208KB2B1 LCK5 1
    21 01CNBP208KB2B1 MEMCASE 1
    22 01CNBP208KB2B1 CRSD 1

    Can anyone help me out? Would save me endless frustration

  2. #2
    Registered User
    Join Date
    05-07-2015
    Location
    here
    MS-Off Ver
    '11
    Posts
    3

    Re: Convert multiple rows of horizontal data into three rows of vertical data

    I've managed to put the following together. This formula gives me what I need for the first chunk of it, but instead of copying down all the data from B3, C3 etc to B4, C4 it goes to B8 C8 because it's five rows down.... See below...
    A B C
    1 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A1)-1)/5),) =IF(ISBLANK(CANON!B3),"",CANON!B3) =IF(ISBLANK(CANON!C3),"",CANON!C3)
    2 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A2)-1)/5),) =IF(ISBLANK(CANON!D3),"",CANON!D3) =IF(ISBLANK(CANON!E3),"",CANON!E3)
    3 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A3)-1)/5),) =IF(ISBLANK(CANON!F3),"",CANON!F3) =IF(ISBLANK(CANON!G3),"",CANON!G3)
    4 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A4)-1)/5),) =IF(ISBLANK(CANON!H3),"",CANON!H3) =IF(ISBLANK(CANON!I3),"",CANON!I3)
    5 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A5)-1)/5),) =IF(ISBLANK(CANON!J3),"",CANON!J3) =IF(ISBLANK(CANON!K3),"",CANON!K3)
    6 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A6)-1)/5),) =IF(ISBLANK(CANON!B8),"",CANON!B8) =IF(ISBLANK(CANON!C8),"",CANON!C8)
    7 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A7)-1)/5),) =IF(ISBLANK(CANON!D8),"",CANON!D8) =IF(ISBLANK(CANON!E8),"",CANON!E8)
    8 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A8)-1)/5),) =IF(ISBLANK(CANON!F8),"",CANON!F8) =IF(ISBLANK(CANON!G8),"",CANON!G8)
    9 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A9)-1)/5),) =IF(ISBLANK(CANON!H8),"",CANON!H8) =IF(ISBLANK(CANON!I8),"",CANON!I8)
    10 =OFFSET(CANON!$A$3,INT((ROWS($A$1:A10)-1)/5),) =IF(ISBLANK(CANON!J8),"",CANON!J8) =IF(ISBLANK(CANON!K8),"",CANON!K8)


    A little clarification on the above ... My data is located in a sheet named Canon. My data starts on row 3. The "SKU"s are in column B, and the items / qty alternate from column C through K

    Any help is appreciated
    Last edited by msutton; 06-10-2015 at 01:28 AM.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Convert multiple rows of horizontal data into three rows of vertical data

    It can be easily achieved by using VBA instead of using a complex formula.

    Please confirm whether VBA solution is Okay for you or you want to do it in formula only?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    05-07-2015
    Location
    here
    MS-Off Ver
    '11
    Posts
    3

    Re: Convert multiple rows of horizontal data into three rows of vertical data

    Quote Originally Posted by :) Sixthsense :) View Post
    It can be easily achieved by using VBA instead of using a complex formula.

    Please confirm whether VBA solution is Okay for you or you want to do it in formula only?
    Unfortunately I don't know heads or tails from VBA, but if it's that much easier I can do some googling and apply your solution once I figure it out.

  5. #5
    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: Convert multiple rows of horizontal data into three rows of vertical data

    OK. here's a complex solution. By PM, you've advised me of a smpler way to do column A. Great - use it. Now you have two choices:

    EITHER: copy and paste values (to remove formulae) and filter on column B, deleting all rows with a zero;

    OR: copy the non-zero rows to another sheet. If you need a hand with that - let me know.
    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

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Convert multiple rows of horizontal data into three rows of vertical data

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


    Please Login or Register  to view this content.
    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

    Attached a sample file for your easy reference

    Note: Please don't waste our time by way of sending ping messages to many persons. Even me too received ping message for this one and wasted my time in writing this code.
    Attached Files Attached Files

+ 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. Replies: 10
    Last Post: 06-26-2015, 09:05 AM
  2. Replies: 5
    Last Post: 04-26-2015, 11:04 AM
  3. Replies: 2
    Last Post: 06-06-2012, 07:13 PM
  4. Convert multiple x rows for a record to single - vertical to horizontal data
    By DinLA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2011, 11:47 PM
  5. Convert multiple rows into one, vertical to horizontal data
    By ortho-research in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2009, 01:07 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