+ Reply to Thread
Results 1 to 3 of 3

How to get multiple column data in single column

Hybrid View

raj0070 How to get multiple column... 05-11-2011, 04:50 PM
raj0070 Please help..How to get... 05-12-2011, 09:56 AM
tarquinious Re: Please help..How to get... 05-16-2011, 10:26 AM
  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to get multiple column data in single column

    Hi,
    I have been trying to get this puzzle solved but to no avail.....I have got two spreadsheets...I want to get A/C Key in sheet 1 from sheet 2 based on CSI (unique) no. and also if there is no A/C key than I want to bring all the A/C keys assigned to the respective account (lookup by first three numbers- in this case 502) in a single column against that account. I have attached a scenario underneath... Thanks
    Sheet 1
    CSI A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3

    Sheet 2
    CORP A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3

    RESULT SET THAT I WANT IS
    SHEET 1

    CSI A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502 320FIVE1
    320FIVE2
    320FIVE3
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3
    Last edited by raj0070; 05-12-2011 at 03:24 PM.

  2. #2
    Registered User
    Join Date
    05-11-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Please help..How to get multiple column data in single column

    Hi,
    I have been trying to get this puzzle solved but to no avail.....I have got two spreadsheets...I want to get A/C Key in sheet 1 from sheet 2 based on CSI (unique) no. and also if there is no A/C key than I want to bring all the A/C keys assigned to the respective account (lookup by first three numbers- in this case 502) in a single column against that account. I have attached a scenario underneath... Thanks
    Sheet 1
    CSI A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3

    Sheet 2
    CORP A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3

    RESULT SET THAT I WANT IS
    SHEET 1

    CSI A/C KEY
    102300 320ONE0
    202300 320TWO0
    302300 320THREE0
    402300 320FOUR0
    502 320FIVE1
    320FIVE2
    320FIVE3
    502301 320FIVE1
    502302 320FIVE2
    502303 320FIVE3

  3. #3
    Registered User
    Join Date
    05-13-2011
    Location
    New Zealander in London
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Please help..How to get multiple column data in single column

    Quote Originally Posted by raj0070 View Post
    Hi,
    I have been trying to get this puzzle solved but to no avail.....I have got two spreadsheets...I want to get A/C Key in sheet 1 from sheet 2 based on CSI (unique) no. and also if there is no A/C key than I want to bring all the A/C keys assigned to the respective account (lookup by first three numbers- in this case 502) in a single column against that account. I have attached a scenario underneath... Thanks
    It is very difficult to see if I have this right as the formatting of your test data is missing, however the macro below should be a pretty close match to what you're after.
    Sub CollateData()
        
        FirstSheetName = ActiveSheet.Name
        ThirdSheetName = "Sheet3"
        FirstSheetRow = 2
        ThirdSheetRow = 2
    
        Range("A2").Activate
        Do Until ActiveCell = ""
            If ActiveCell.Offset(0, 1) <> "" Then
                Corp = ActiveCell
                AC = ActiveCell.Offset(0, 1)
                KeyVal = ActiveCell.Offset(0, 2)
                Sheets(ThirdSheetName).Activate
                Range("A" & ThirdSheetRow) = Corp
                Range("B" & ThirdSheetRow) = AC
                Range("C" & ThirdSheetRow) = KeyVal
                ThirdSheetRow = ThirdSheetRow + 1
                Sheets(FirstSheetName).Activate
            Else
                Corp = ActiveCell
                Range("A2").Activate
                Do Until ActiveCell = ""
                    If Len(ActiveCell) > 3 And Val(Left(ActiveCell, 3)) = Corp Then
                        AC = ActiveCell.Offset(0, 1)
                        KeyVal = ActiveCell.Offset(0, 2)
                        Sheets(ThirdSheetName).Activate
                        Range("A" & ThirdSheetRow) = Corp
                        Range("B" & ThirdSheetRow) = AC
                        Range("C" & ThirdSheetRow) = KeyVal
                        ThirdSheetRow = ThirdSheetRow + 1
                        Sheets(FirstSheetName).Activate
                    End If
                    ActiveCell.Offset(1, 0).Activate
                Loop
                Range("A" & FirstSheetRow).Activate
            End If
            ActiveCell.Offset(1, 0).Activate
            FirstSheetRow = FirstSheetRow + 1
        Loop
    End Sub

+ 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: 05-20-2020, 03:08 AM
  2. [SOLVED] Capturing Multiple Column’s Data in a Single Column Based on Criteria
    By Rajeshkumar R in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2020, 01:40 PM
  3. [SOLVED] How to combine multiple column data to single column using formula
    By krishnakuma6 in forum Excel General
    Replies: 6
    Last Post: 06-05-2018, 06:13 AM
  4. Merge specific column data from multiple sheets in single column of new workbook.
    By kadam203 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2016, 01:58 AM
  5. Split Data From Single Column Set Into Multiple Column Sets?
    By slavrenz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-25-2014, 04:33 AM
  6. Transpose Data from Multiple Column to Single Column
    By smudger1989 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-12-2013, 04:38 AM
  7. Replies: 5
    Last Post: 02-07-2012, 04:55 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