+ Reply to Thread
Results 1 to 7 of 7

combining different cell values in sequential order

Hybrid View

  1. #1
    Registered User
    Join Date
    08-30-2015
    Location
    chicago
    MS-Off Ver
    2007
    Posts
    32

    combining different cell values in sequential order

    Attached is a sample copy of raw data.

    Source is present in Sheet1.
    Desired output is shown in Sheet1.
    Desired output should be produced by removing all the source data in Sheet1.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: combining different cell values in sequential order

    As a courtesy to other members, please detail your question IN your thread, so that members dont need to open a file to see what you want
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    08-30-2015
    Location
    chicago
    MS-Off Ver
    2007
    Posts
    32

    Re: combining different cell values in sequential order

    cell values of Multiple columns and rows have to be combined
    Last edited by macrolearnerkk; 10-02-2015 at 07:04 AM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: combining different cell values in sequential order

    Does this help?

    Sub macrolearnerkk()
    Dim i As Long, x As String
        For i = 1 To Range("D" & Rows.Count).End(3).row
            If Cells(i, "B") <> "" Then
                x = Cells(i, "B") & " " & Cells(i + 2, "D") & " " & Cells(i + 1, "C")
                Range("F" & Rows.Count).End(3)(2) = x
            End If
        Next i
    End Sub

  5. #5
    Registered User
    Join Date
    08-30-2015
    Location
    chicago
    MS-Off Ver
    2007
    Posts
    32

    Re: combining different cell values in sequential order

    Simply awesome !!

    Could you also please look at the following !

    Sample attached
    Attached Files Attached Files
    Last edited by macrolearnerkk; 10-02-2015 at 06:55 AM.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: combining different cell values in sequential order

    Perhaps:

    Sub macrolearnerkk()
    Dim i As Long, x As String, y As Long
    y = ActiveSheet.UsedRange.Columns.Count + 1
        For i = 2 To Range("A" & Rows.Count).End(3).row
            If Cells(i, "D") <> "" And Cells(i + 2, "F") <> "" And Cells(i + 1, "E") <> "" Then
                x = Cells(i, "D") & " " & Cells(i + 2, "F") & " " & Cells(i + 1, "E")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "D") <> "" And Cells(i + 2, "F") = "" Then
                x = Cells(i, "D") & " " & Cells(i + 1, "E")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "D") <> "" And Cells(i + 1, "E") = "" Then
                x = Cells(i, "D") & " " & Cells(i + 2, "F")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "D") <> "" And Cells(i + 1, "E") = "" And Cells(i + 2, "F") = "" Then
                x = Cells(i, "D")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "K") <> "" And Cells(i + 2, "M") <> "" And Cells(i + 1, "L") <> "" Then
                x = Cells(i, "K") & " " & Cells(i + 2, "M") & " " & Cells(i + 1, "L")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "K") <> "" And Cells(i + 2, "M") = "" Then
                x = Cells(i, "K") & " " & Cells(i + 1, "L")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "K") <> "" And Cells(i + 1, "L") = "" Then
                x = Cells(i, "K") & " " & Cells(i + 2, "M")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "K") <> "" And Cells(i + 1, "L") = "" And Cells(i + 2, "M") = "" Then
                x = Cells(i, "K")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "E") <> "" And Cells(i + 1, "F") = "" And Cells(i - 1, "D") = "" Then
                x = Cells(i, "E")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
            If Cells(i, "L") <> "" And Cells(i + 1, "M") = "" And Cells(i - 1, "K") = "" Then
                x = Cells(i, "L")
                Cells(Rows.Count, y).End(3)(2) = x
            End If
        Next i
    Range(Cells(1, 1), Cells(1, y - 3)).EntireColumn.Delete
    Columns(1).ClearContents
    Columns(2).ClearContents
    End Sub

  7. #7
    Registered User
    Join Date
    08-30-2015
    Location
    chicago
    MS-Off Ver
    2007
    Posts
    32

    Re: combining different cell values in sequential order

    Code looks great.

    Once again, thank you for your help .
    Last edited by macrolearnerkk; 10-02-2015 at 01:18 PM.

+ 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. Repeating Numbers In Sequential Order
    By artiststevens in forum Excel General
    Replies: 3
    Last Post: 02-05-2015, 05:27 AM
  2. ORGANISE worksheets in SEQUENTIAL order
    By JamesGoulding85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2013, 08:26 AM
  3. to number the rows in Sequential order
    By shanmp in forum Excel General
    Replies: 2
    Last Post: 01-25-2008, 10:59 AM
  4. [SOLVED] LOOPING BUT THE MARKS ARE NOT IN SEQUENTIAL ORDER
    By sam.fares@cmcsg.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-28-2006, 10:00 PM
  5. [SOLVED] LOOPING BUT THE MARKS ARE NOT IN SEQUENTIAL ORDER #3
    By sam.fares@cmcsg.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2006, 10:00 PM
  6. [SOLVED] Creating a list in sequential order
    By Mark Jackson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-07-2005, 07:15 PM
  7. Countif data is not all in sequential order
    By heater in forum Excel General
    Replies: 2
    Last Post: 07-28-2005, 02:06 PM
  8. data from one sheet to several in sequential order!
    By firecord in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 06-22-2005, 12:10 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