+ Reply to Thread
Results 1 to 5 of 5

URGENT Please help with list alignment VBA

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    3

    URGENT Please help with list alignment VBA

    Hello, I am running Excel 2011 on a Mac and I am currently working on a systematic review paper of some scientific literature. I had to catalog a larger search as two smaller searches, and so I now have two separate lists that I have to align to the main list (which doesn't have all the supplementary data I need).

    The main list that I want to align the data to is on the left. On the right are the two searches put together to make a master search. Unfortunately, there is a slight difference in the number of results in each list. The main (correct) list has 588, while the two searches put together have 592. My hope is that after alignment, the four entries that don't belong can just be thrown out. Here is how my spreadsheet is organized (row E is blank).

    A---------B---------C----------D---------E--------F---------G-----------H--------I--------J--------...more data
    1--------yr1----author1----journal1---|---------yr10----auth142----journal32-----PROJECT DATA
    2--------yr1----author2----journal2---|---------yr5-----auth284----journal15-----PROJECT DATA
    3--------yr2----author1----journal3---|---------yr9-----auth312----journal28-----PROJECT DATA
    4--------yr3----author3----journal3---|---------yr12----auth13-----journal42-----PROJECT DATA

    Every entry on the left has a match on the right, but not every entry on the right has a match on the left. Can someone please help me with a VBA program that will match the entries on their right to the correct order as shown on the left?

    Thank you very much in advance!

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: URGENT Please help with list alignment VBA

    Hi

    I can't see that there is any relationship between the 2 list of data you have provided.

    Can you attach a workbook example, showing both the before and after situations, and how that output was achieved.

    rylo

  3. #3
    Registered User
    Join Date
    04-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: URGENT Please help with list alignment VBA

    Thanks for replying so quickly, rylo!

    Attached is a workbook with an example of the formatting. The real version contains 588 (and 592) in the left and right lists respectively, but the idea is that the year, author, and journal have to be matched and then if they match, the entire row on the right has to be aligned with the corresponding row on the left. The color coding of the list on the right is very important and I need to keep that.

    I am not sure of how to do this in VBA (or any way that works!) and I'd appreciate some help.

    Thanks again for your help!

    example first 41.xlsx

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: URGENT Please help with list alignment VBA

    Hi

    Using your example file:
    E2: =SUMPRODUCT(--($B$2:$B$42=F2),--($C$2:$C$42=G2),--($D$2:$D$42=H2),ROW($D$2:$D$42))
    Copy down to E42

    Select the range E2:AE42
    Data, Sort, Sort by column E, smallest to largest.

    This will sort your data based on the row it should align against. Is this the correct order of the output? If so, then what do you want to do with the non matching items?

    Please Login or Register  to view this content.
    rylo
    Last edited by rylo; 04-12-2012 at 12:19 AM. Reason: put in some starter code

  5. #5
    Registered User
    Join Date
    04-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: URGENT Please help with list alignment VBA

    Thank you so much for your help! It's getting late here, but I finally was able to get it done with your assistance.

    Much appreciated!

    saraspatula

+ 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