+ Reply to Thread
Results 1 to 68 of 68

Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello Dear Excel Expert!

    I got an vba code that does the followings
    Loop through all worksheets in a workbook.
    Copy Data in Sheet(1) By Matching Column Headers.

    Here is the code

    Please Login or Register  to view this content.
    Background!
    The data file that I got from databases administrator, is in MS EXCEL 2003 version.
    The data is big in term of rows and columns so due to the number of columns limitation in Excel 2003.
    Data with same Unique IDs are organized in next worksheets with the helper column "responseID" i.e. Column A in all worsheets.

    For example;

    If worksheet (1) has the data of ID "5" and it exceeds the number of column limitation (MS 2003) then its further data are placed to worksheets (2) if it still exceeds the column limitation then the data is placed to worksheet (3) and so on and it may goes from 1 to 50 worsheet(s)....but each worksheet has the uniqueID identifier in Column A i.e."responseID".

    Process
    What I do when i receive the file from database administrator,


    I create new MS EXCEL WORKBOOK,as we work with MS EXCEL 2010 version (as there are extended number of columns 16384 I think, as compared to MS EXCEL 2003 that has only 255 Columns).

    I copied all worksheets data into one worksheet by matching columns in it .Hectic Job!!!!

    (I receive the file on daily basis with records ("ID") addition / deletion). This is another long process because as we receive any file, we start working on the data of this file, so newly received file will not have the changes incorporated that has been made to previous file......I dont want to describe this process here....I am working on this too in order to automate this section through any feasible way out...)

    Goal

    The above macro is not serving my purpose when it goes to next worksheets, it does not match the ID and place the data to its relevant row by matching ID,it only matching the column.

    Do you people have any idea how this can be achieved!

    Would be grateful to you people.

    Blessings

    Thank you!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello Ariff_Chowdhury,

    Can you post a 2003 workbook with the multiple sheets (does not need to have all 50) and an example 2010 of what the data should like after the macro runs?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear Leith Ross,

    Thank you for your reply,

    I have attached a file named "Match Rows and Columns.xlsm".

    The File contains 6 worksheets;

    Worksheet named "Combined", where the result should be appeared by matching row ID (in column "A" in all worksheets other than Combined worksheet) and column headers (Row 1 in all worksheets) of all worksheets in the file.
    Worksheets named "1","2","3","4","5". are my source worksheets data of just one project.

    Meanwhile I am getting the headers (ROW 1) manually in the worksheets "Combined" by copying the row 1 from all worksheets."1","2","3" and so on.

    There is macro button placed on worksheet "Combined" please run it when get the macro finished look at the Column B you will find duplicate IDs in this column because macro is not matching the rows IDs it just matching Column headers...

    Thanks once again for your interest.

    Blessings!
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello Ariff_Chowdhury,

    Thanks for posting the workbook. This makes it clearer what you want to do. It is always best to have the original data and layout to work with.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    What about the rows - don't they line up??
    Last edited by xladept; 07-27-2013 at 04:51 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  6. #6
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear xladept,
    Yes they dont line up the data of that specifc row IDs

    Thanks!

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello Ariff_Chowdhury,

    On sheet "1" there are multiple instances of id numbers. Which one should be copied to "Combined"?

  8. #8
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Leith Ross,

    In all source worksheets, the column headers "responseid" located in Column "A" this is unique identifier,we identify our data with this "ID" it can never be duplicated.
    However there is another header in column B named "respid" has the same data but we do not refer this as unique identifier.(we treat this just a data).
    One more thing, in the worksheet ("Combined") macro generate serial number in Column A.

    Is that clear ?

    Thanks!

  9. #9
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear Leith Ross,

    I do not understand why did you mention "Which one should be copied to "Combined"?" what do you mean "should be copied" ?
    The "Combined" worksheet will copy all the data by matching column if any header not available in the combined worksheet then macro should not copy that column of data from all source worksheets....

    Did you get my point ?

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello Ariff_Chowdhury,

    Never mind, I had the sheet scrolled over to right and was looking at numbers I thought were the IDs.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Are the "Serial by Macro" really just consecutive numbers??

    What, exactly, are we supposed to match to???
    Last edited by xladept; 07-27-2013 at 10:38 PM.

  12. #12
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear xladept,
    I have mentioned about this in earlier thread, Yes "Serial By Macro" just consecutive numbers generated macro, we do not need match this column with,

    We have to match column header "responseid" located in Column "A" in all source worksheets.

    Does this clear ?

  13. #13
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    BUMP - need a reply!!!

    Any suggestion!

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Maybe, had you posted the 2003 sample as Leith suggested, it would have come clear to me. But, as it is, I'm still puzzling over it

  15. #15
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Where are you getting puzzled ?....May be i help you!

  16. #16
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    xladept,

    I would request you read my first thread! where you get stuck reference with this line of sentence..

    Thank you!

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    The way I understand it:

    A subsidiary worksheet’s first column must match to the column header already in place in the “combined” sheet, however the rows don’t line up (may we assume that they’re in order?). So each row’s column “A” entry must match to the response-id in column 2 of the combined sheet (are the response-ids already present in column 2?)

    So, is the “combined” sheet already set up with the column headers and the response-ids?

  18. #18
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    A subsidiary worksheet’s (SOURCE WORKSHEETS) first column (COLUMN A) i.e. "responseID" must match to the column header already in place in the “combined” sheet (YES),


    however the rows don’t line up (may we assume that they’re in order?) (All source worksheets responseID are always in ascending order). So each row’s column “A” (COLUMN A of ALL SOURCE WORKSHEETS) entry must match to the response-id in column 2 of the combined sheet (YES - COLUMN B OF COMBINED WORKSHEETS) (are the response-ids already present in column 2?) ("NOT THE MACRO PULLED IT THE MACRO I ATTACHED WITH THIS FILE")

    So, is the “combined” sheet already set up with the column headers (YES I MANUALLY COPY FROM ALL SOURCE WORKSHEETS AND PASTE INTO COMBINED WORKSHET)and the response-ids (MACRO WILL PULL RESPONSE IDS IT IS NOT SET UP)?


    I am attaching this file there is button in "Combined Worksheet" please run and you will observe duplicate/ triplicate responseID in Column B (responseID) in "Combined" Worksheet.
    Match Rows and Columns.xlsm

  19. #19
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear xladept,

    Plaese ignore the file,Match Rows and Columns updated.xlsm.I have attached new amended file now the picture will get clear to you.

    Please run the macro button placed on combined worksheets and tell me what you have noticed...

  20. #20
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Try this and let me know if it's OK:

    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept!

    I ran this in my original data (just same as file i attached in my second thread which has massive data)
    The macro took around 10-15 minutes to complete its session.after finished the result is not as expected...
    I didn't even copy the data of sheet 2,3,4 and 5

    Only copies the data of sheet "1"

  22. #22
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    I'll look at it again tomorrow - does the new code do as you expected with the last sample?

    We may need to rewrite the routine because of the time it takes this way.

  23. #23
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    xladept, in the last sample the code worked partially!


    Because I have need to add column in my destination worksheet so i added some column in between then run the code it didn't copied the column of data after the column addition.

    And we need to add a line of code to clearconents in destination worksheet because if the macro is run again then it also not working as it should be.

    Thanks for your time xladept!

  24. #24
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Did you add the header for the new column?? - No matter, we'll look at the big file tomorrow - will there be any changes in that??

  25. #25
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Yes I added the header for new columns.


    Here is short process of my working;may be it help you understand the process.

    I receive this big data file from DB administrator in MS EXCEL 2003 version.
    I convert that file into MS 2010 version give the file name Master and then copy the data of all its worksheets into one worksheets by matching columns headers and row IDs
    Then i add columns in between the existing columns to start my working on the file.


    Next day i again receive the new file from DB administrator with addition of responseIDs.
    I delete all those responseID from this newly received file,the resonseID which are already exist in my Master file and only copy the new responseID's data by matching column headers.

    This big data file is the data of only one project. simultaneously there are 20-25 projects runs at a time
    This exercise repeats until the project is finishes after the project finished then i send my master file to concerned department for their working.


    Hope this helps!

  26. #26
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi,
    Any developement! i exhausted my search capabilities

  27. #27
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    If the extra Worksheets are just to accommodate the column overflow then why can't they just be pieced back together in the same order as they were created - if they can, the routine would be simple to write???

  28. #28
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Good Point!

    Reason is the suppose we receive first file from DB Administrator contains in total 300 columns
    And i have copied all the data into one master worksheets.
    Second day we receive another file with addition of some column and responseIDs in betwen the data say 305 columns.
    Then sequence of column orders with the source worksheets and destination worksheets will be different.

    Got my point ?

  29. #29
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Is there anyone who solve this grave issue ??

  30. #30
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    I'm in the throes of rewriting it now - if I think I've solved it I'll post my solution.

  31. #31
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Oh xladept! thank you for your interest and your extended consistent efforts! Looking forward to your solution!

  32. #32
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Try this - let me know of any discrepancies - it's just a "template" for big file code:

    Please Login or Register  to view this content.

  33. #33
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hello xladept!
    No luck! unexpected results came out.

  34. #34
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    I've been using your first posted sample, is there anything wrong with that? And, I'm still writing the routine - so can you please specify what is happening that shouldn't???

  35. #35
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Here's a quick version; so that your test won't take so long - I can rework the logic in this version as well as the slower version:

    Please Login or Register  to view this content.
    But I got the first record, the last record and a record in the middle, so I'm curious as to the unexpected result?

  36. #36
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    I just have a quick test on my original data file twice/thrice in different way...
    This code worked fine and the faster than previous one as well....To get thorough check i will have to give it a day...

    There are two things if you can do easily....
    Can we delete the line of code which is creating the first column serialization by macro in combined worksheets, we don't actually need it?

    Secondly there are more worksheets will be exist in workbook since the macro is compiling the data from all worksheets other than combined so can we add line of code to exclude worksheets for which we do not want to pull data in combined worksheets ? like I have name of worksheets in the workbook...that need to be exclude..

    "AddHeader"
    "CodeList"
    "AddColumns"
    "Summary"
    "Reports"
    "CAPI" etc...



    One more question i need to ask that can we rely on vba for such job to be done ?
    Because the data set is too large and each and every time checking each columns and rows are not possble for me...

  37. #37
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    To answer your questions in reverse:

    Yes, we can rely on the VBA to keep doing what its been doing.

    "AddHeader"
    "CodeList"
    "AddColumns"
    "Summary"
    "Reports"
    "CAPI" etc...
    these can all be excluded or do the sheets we're including have something common in their names.

    The macro-generated serials need not be generated but do you want to keep that column at all?

  38. #38
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Here's where it stands now - how many more sheetnames will we need to add to the WSheets array in the Included function?

    Please Login or Register  to view this content.
    Last edited by xladept; 07-31-2013 at 08:00 PM.

  39. #39
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept, in this part array will include those worksheets for which i want to pull data into combined worksheet right ?

    Please Login or Register  to view this content.
    Sicne coulple of days I am too busy in delivering the data of existing project therefore I could not get a chance to check it thorougly..but i will check and revert to you soon

    AND THANK YOU SO MUCH FOR YOUR TIME AND EFFORTS.

    REALLY APPRECIATING!

    THANKS AGAIN AND AGAIN AND AGAIN!

  40. #40
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Quite the opposite!
    The array is of the worksheets that you want to exclude, that you don't want to pull data from!

  41. #41
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept!

    if you remember that we have deleted the serial by macro serial numbers below the reference line;

    Can we delete the line of code which is creating the first column serialization by macro in combined worksheets, we don't actually need it?
    But we need macro to be start from column A - COLUMN A is my responseID.

    Please Login or Register  to view this content.

  42. #42
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Are you saying that the "CompiledData" sheet will not have the serial by macro column which is column A in the "Combined" sheet?

    If that's the case then here's your code changed to accommodate the new spec:

    Please Login or Register  to view this content.
    Last edited by xladept; 08-04-2013 at 07:24 PM.

  43. #43
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Try the attached
    Attached Files Attached Files

  44. #44
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept!

    I want to send you my original file how can i send you privately ?

    I need to show you something that is going beyond to my head!

  45. #45
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    [email protected] is my email

  46. #46
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Dear xladept!
    I have sent you the file please check!

  47. #47
    Registered User
    Join Date
    08-05-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    thank u very much,i got the solution....,

  48. #48
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    @ chakravarthysm

    If you're thanking me then you're welcome

  49. #49
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    I made a quick fix (one line of code) and I'm not experiencing the problems that you've cited:

    Please Login or Register  to view this content.

  50. #50
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Again Thank you xladept for you non-stop cooperation and contribution. However it will give it a check in the file.

    And definitely chakravarthysm is thanking to you...

  51. #51
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Xladept,

    In your file please add a column after COLUMN A between "responseID" and "respid" give any name to newly added column and then run macro, see what happens!

  52. #52
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Try this:

    Please Login or Register  to view this content.

  53. #53
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept,
    Let me check! will let you know on this very soon

    Thanks again!

  54. #54
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi,
    I am getting error in this line, Don't know why
    Please Login or Register  to view this content.

  55. #55
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    With your sample, I get no error - have you another sample that the routine fails on??

  56. #56
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept,
    Thanks for your reply, I am not using any other routine but the following, I am getting Runtime error 9 "Script out of range".on the highlighted line. if you please check.

    Please Login or Register  to view this content.

  57. #57
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Can you post the new sample?

    *I suspect that you have an unmatched column - either the header is different or you have no column.
    Last edited by xladept; 01-29-2014 at 10:45 AM.

  58. #58
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept,

    Hope you're doing great!

    Due to the some issues i couldn't respond you on time.

    Match Rows and Columns 18-04-14.xlsm
    Please find attached file, i am still getting error on below line, however sometime it works but I am not getting desired outputs.

    Please Login or Register  to view this content.

    For ease, i have included a sheet named "Desired_Result" which may help you to understand it.

    Looking forward to your usual cooperation!

    Thanks so much.

  59. #59
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    I'm working on it
    Last edited by xladept; 04-18-2014 at 06:46 PM.

  60. #60
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    When using this program you must have the output sheet name specified in this line:

    Set wc = Sheets("Combined") - but there were also other issues.

    Try this:Ariff.xlsm

  61. #61
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept!

    Hope you're fine!

    It is my good luck that I got you online.

    I checked the file and ran the macro, after pressing the button, it removed all the headers & appended only IDs in "Combine" sheet.

    Please note that we manually combine the headers in combine sheet & we do not need macro to do this automatically, there are some reasons.

    But we need macro to look into the specific sheets (like sheet 1,2,3,4,5 as an example in the file) and compile / append all the data in combine sheet by looking at (matching) the columns.

    Would highly appreciate if you please look into this.

    THANKS VERY VERY MUCH FOR ALL YOUR EFFORTS!

  62. #62
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    This is weird! I have exactly the desired results - did you use the book I sent you? - I changed the function too! - Please send the book you used

  63. #63
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi xladept,

    Yes i used the same book that you have attached, I am attaching the same one,Ariff.xlsm just only click the button and see what happen.

    Thanks!

  64. #64
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Very weird, my copy works as advertised but yours fails????????

  65. #65
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    Thanks for the rep - I'd like to get to the bottom of this, may I present it to all forum contributors?

  66. #66
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    xladept, did you face the same issue that i have faced ? when i click on the button it removes all headers & extract only response id.

    Yes you can present it whomsoever you want to....


    Thanks xladept for your continued cooperation

  67. #67
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    It's like it stopped halfway - I'm still looking into it and, if I don't get a solution, I'll put it before the forum - thanks!

  68. #68
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs

    Hi Ariff,

    It's OK nowAriffXXX.xlsm

+ 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. [SOLVED] VBA to Populate Sheets by Matching column headers
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 56
    Last Post: 11-06-2013, 08:41 AM
  2. Replies: 1
    Last Post: 07-26-2011, 02:58 AM
  3. Replies: 5
    Last Post: 10-27-2010, 11:00 AM
  4. Retrieve Row Data From Multiple Worksheets and Display in a hyperlinked list
    By westond in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-07-2008, 06:09 PM
  5. Combine a Matching Column Headings' data in 2 Worksheets to 1
    By ravdog44 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2006, 03:42 AM

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