+ Reply to Thread
Results 1 to 6 of 6

Row split in to multiple rows based on cell data

  1. #1
    Registered User
    Join Date
    02-08-2011
    Location
    hawaii
    MS-Off Ver
    Excel 2007
    Posts
    3

    Red face Row split in to multiple rows based on cell data

    Hello
    I need to get my data off an inventory sheet to a oddly formatted second sheet.

    I have data on a sheet including item name, item number, item color, and item count base on size (size is broken over multiple columns e.g. small, medium, large)

    It need to be on sheet 2 with columns as item name, item number, item color, item count

    Each row from sheet 1 is copied to sheet 2 but it gets tricky because rows need to be additionally duplicated based on presence of a size. And that size need to be appended to the item name.
    item name column e.g.
    name1
    name1 | size | Large
    name1 | size | X-Large

    Additionally the size columns are totaled

    TIA
    I manually made a file with sheet1 being a basic sample of what i have and sheet 2 being the required formatting. Please see attached test xlsx
    Attached Files Attached Files
    Last edited by bosuck; 02-08-2011 at 05:30 PM.

  2. #2
    Registered User
    Join Date
    02-08-2011
    Location
    hawaii
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Row split in to multiple rows based on cell data

    I am not the master of excel but can do somethings - I made a complicated if statement trying to solve my problem, but i need something more because it stops after finding the first positive response and does not incorporate addition of the addition of new lines

    =IF(Sheet1!D2>0,Sheet1!A2&"| Size| X-Small",IF(Sheet1!E2>0,Sheet1!A2&"| Size| Small",IF(Sheet1!F2>0,Sheet1!A2&"| Size| Medium",IF(Sheet1!G2>0,Sheet1!A2&"| Size| Large",IF(Sheet1!H2>0,Sheet1!A2&"| Size| X-Large",IF(Sheet1!I2>0,Sheet1!A2&"| Size| X-Large",IF(Sheet1!J2>0,Sheet1!A2&"| Size| XXX-Large",)))))))

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Row split in to multiple rows based on cell data

    bosuck,

    Welcome to the Excel Forum.

    I assume that your raw data is on Sheet1.

    Detach/open workbook ReorgData w1 w2 plus Sum - bosuck - EF763515 - SDG13.xlsm and run macro ReorgData.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Row split in to multiple rows based on cell data

    This was what I came up with, sorry I got lost at work... heh.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JBeaucaire; 02-08-2011 at 03:45 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Row split in to multiple rows based on cell data

    Thanks for the feedback.

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  6. #6
    Registered User
    Join Date
    02-08-2011
    Location
    hawaii
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Row split in to multiple rows based on cell data

    Thanks! it works perfect.
    I need to try to review the code a bit because need to expand it a bit- i have additional columns after the size columns that just need to be repeated every time a row is made - the same as the 'item number' or 'item color' columns

    Mahalo!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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