+ Reply to Thread
Results 1 to 10 of 10

How to Combine multiple Column into single row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-11-2015
    Location
    Jakarta, Indonesia
    MS-Off Ver
    2019
    Posts
    118

    How to Combine multiple Column into single row

    Hello Everyone

    i need your help
    i have data with format as below

    actually this data was in Pivot format before i pasted as text

    but now i need to break it as raw data which was used when generating pivot table , with combine each model and sizes in single row

    i have more than 50 model to combine with size, so if it done manually, will took a time

    attached the file with expected result

    thank you
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Did13n; 03-03-2017 at 09:05 AM.
    a fool learn from experiences,wise from others

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: Need Help on Formulas

    Suggest you rename the subject while you can before a mod steps in.

    Rule 1
    http://www.excelforum.com/forum-rule...rum-rules.html

    With 52 posts you should know this by now.

    Until you change the subject noone can solve your problem for fear of receiving infractions.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    02-11-2015
    Location
    Jakarta, Indonesia
    MS-Off Ver
    2019
    Posts
    118

    Re: Need Help on Formulas

    Quote Originally Posted by Special-K View Post
    Suggest you rename the subject while you can before a mod steps in.

    Rule 1
    http://www.excelforum.com/forum-rule...rum-rules.html

    With 52 posts you should know this by now.

    Until you change the subject noone can solve your problem for fear of receiving infractions.
    ok K, thanks for reminding,

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: How to Combine multiple Column into single row

    This should work

    Sub k1()
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row
    j = 6
    For i = 6 To lastrow
    For k = 5 To 7
    Cells(j, 11) = Cells(i, 2) & "-" & Cells(5, k)
    Cells(j, 12) = Cells(i, 3)
    Cells(j, 13) = Cells(i, k)
    Cells(j, 14) = Cells(i, 4)
    Cells(j, 15) = Cells(j, 13) * Cells(j, 14)
    j = j + 1
    Next k
    Next i
    End Sub
    Input on Sheet1
    Output goes to the cells defined in your output grid so you'll need to move them if you want it somewhere else.

  5. #5
    Forum Contributor
    Join Date
    02-11-2015
    Location
    Jakarta, Indonesia
    MS-Off Ver
    2019
    Posts
    118

    Re: How to Combine multiple Column into single row

    Quote Originally Posted by Special-K View Post
    This should work

    Sub k1()
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row
    j = 6
    For i = 6 To lastrow
    For k = 5 To 7
    Cells(j, 11) = Cells(i, 2) & "-" & Cells(5, k)
    Cells(j, 12) = Cells(i, 3)
    Cells(j, 13) = Cells(i, k)
    Cells(j, 14) = Cells(i, 4)
    Cells(j, 15) = Cells(j, 13) * Cells(j, 14)
    j = j + 1
    Next k
    Next i
    End Sub
    Input on Sheet1
    Output goes to the cells defined in your output grid so you'll need to move them if you want it somewhere else.
    actually i am not familiar with how work with macro code as mostly i finished my excel works with formulas instead macro codes
    however let me try your solutions into my working deck, this can be something new for me ...

    if others have a solutions in formulas, highly appreaciated.

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: How to Combine multiple Column into single row

    Using formulas would be very fiddly.

    Hit Alt-F11 and copy the VBA into the VBA editor

  7. #7
    Forum Contributor
    Join Date
    02-11-2015
    Location
    Jakarta, Indonesia
    MS-Off Ver
    2019
    Posts
    118

    Re: How to Combine multiple Column into single row

    Quote Originally Posted by Special-K View Post
    Using formulas would be very fiddly.

    Hit Alt-F11 and copy the VBA into the VBA editor
    thanks K, on the above case it's done properly ... well it's amazed with that simple codes, i really need to start to learn how works with VBA


    but not run properly to my real case ...i dont know why

    here attached my working sheet ... the result expected in sheet 2

    kindly help
    rgards
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: How to Combine multiple Column into single row

    This is completely different from what you first posted and Im starting to lose interest as I feel Ive been wasting part of my time solving something that wasn't the intended result.

    In your latest spreadsheet:

    1. Sheet 1 column D is called price yet its just a column of ascending values so they dont look like prices to me.
    2. There's no price column in Sheet 2 yet this was in your initial output spreadsheet.
    3. Column Q labelled Quantity looks more like a price.

    If the new spreadsheet is what youre aiming for you should have provided that in the beginning and checked it before posting.

    Use this

    Sub k1()
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row
    j = 4
    For i = 8 To lastrow
    For k = 5 To 16
    Worksheets("Sheet2").Cells(j, 2) = Worksheets("Sheet1").Cells(i, 2) & "-" & Worksheets("Sheet1").Cells(7, k)
    Worksheets("Sheet2").Cells(j, 3) = Worksheets("Sheet1").Cells(i, 3)
    Worksheets("Sheet2").Cells(j, 4) = Worksheets("Sheet1").Cells(i, k)
    Worksheets("Sheet2").Cells(j, 5) = Worksheets("Sheet1").Cells(i, 4) * Worksheets("Sheet1").Cells(i, k)
    
    j = j + 1
    Next k
    Next i
    End Sub

  9. #9
    Forum Contributor
    Join Date
    02-11-2015
    Location
    Jakarta, Indonesia
    MS-Off Ver
    2019
    Posts
    118

    Re: How to Combine multiple Column into single row

    actually mostly same.... but i should keep confidential on some information related to the contains of the file and i believed u understood this already...

    thanks anyway for your codes, again..

    cheers
    Last edited by Did13n; 03-03-2017 at 12:03 PM.

  10. #10
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: How to Combine multiple Column into single row

    Confidential information can be replaced with mock data.

+ 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: 4
    Last Post: 10-19-2016, 02:45 PM
  2. Replies: 9
    Last Post: 12-04-2015, 05:19 PM
  3. Using Cell references in file paths for formulas to create dynamic formulas
    By MichaelStokesJr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2013, 11:49 AM
  4. Replies: 5
    Last Post: 09-25-2013, 02:51 PM
  5. Ctrl+Shift+Enter (CSE) array formulas in VBA using differing formulas
    By officeguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2012, 04:31 PM
  6. Help modifying macro to wrap iferror formulas around existing formulas
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2012, 02:04 PM
  7. Replies: 5
    Last Post: 05-05-2008, 02:22 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