+ Reply to Thread
Results 1 to 13 of 13

Pulling Information in seperate sheet based on data in current sheet

  1. #1
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Exclamation Pulling Information in seperate sheet based on data in current sheet

    Hello all!

    I've got a bit of a quandary here that my novice programming skills can't seem to solve.

    Here is the scenario. I work for a photographic library. We have a spreadsheet that contains 5 or so columns, and a couple of thousand rows. Essentially each row contains an imagine code (the number we use to file away the imagine, ie. US_NY_NYC_1 ) in the first cell, and the image information in the following cells (ie metadata, keywords, photographer, date, etc).

    so a typical row would look as follows:

    Filename | Keywords | Photographer | Metadata | Location |

    all the keyword, photographer, metadata, and location information can only be tied to the one image code whose cell begins the row.

    Now, here is my dilemma. This sheet (lets call it the master sheet) contains all the images we have in a given batch. However, when a client orders images, we will send them most images in that batch, but not all, and we may send a few additional. So I have a separate sheet that contains only those image codes that the client requested. What I need to do is essentially take a code from the second sheet, find that same code in the master sheet, and copy over all the cells associated with that code's row. If the number does not exist in the master sheet, simply leave that row with only the code in the first cell, and the rest blank, and move on.

    so for example, in my second sheet lets say I have the following code: A_B_C . I would like for excel to find that same code in the master sheet, and then copy over the metadata, photographer, date, etc, associated with that code, and paste it into the second sheet, so that that row in the second sheet now looks identical to the row with the same image code in the master sheet . If A_B_C does not exist in the master spreadsheet, then I would like excel to simply leave that code in its own row, leave the rest of the row blank, and move on to the next code.

    My apologies that this is a bit wordy, but I am really in a bind here, and appreciate the help greatly. Thank you kindly!

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Pulling Information in seperate sheet based on data in current sheet

    It sounds eminently possible, but it would be helpful for anyone here if you could attach a small workbook illustrating a sample of your data as is, and your desired results.

  3. #3
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    Hello Stephen,

    Thank you for the prompt reply. I've created a sample of the sort of data I am looking at:

    samplemaster.xls is a sample of what the master sheet might look like (but obviously much truncated in the row number)

    samplesecond.xls is a sample of the second sheet that contains only the file numbers I am trying to sniff out.


    So given this example, in samplesecond.xls, one of the numbers is "ANG_E4_2" which also exists in sample master. I would like to copy the remaining data from that row (row 8) in samplemaster.xls (namely: the "Caption" "CreditLine", "Model Release", and "Keywords" column) to the row in samplesecond.xls to make it look identical in data to the equivalent row in samplemaster.xls
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Pulling Information in seperate sheet based on data in current sheet

    You could use VLOOKUP for this. Here is some code for you try if you wanted to automate it. It goes in the samplesecond file.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    Stephen, thank you, that works brilliantly.

    I was wondering, is there any way to adapt the script to dynamically change the source and destination? more specifically, to use "sheet 1" (the first tab at the bottom of a workbook) of the current workbook as the "Master Sheet" and use "Sheet 2" (the second tab) of the same workbook as the new list with the codes to be appended to? In this way, I can pass this script around the office as a macro, and have them use it on whatever batch they are currently working on.


    Thank you again, Stephen, very much appreciated.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Pulling Information in seperate sheet based on data in current sheet

    Try this:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    Hey Stephen,

    I tried that code when I got in to work today, and it doesn't seem to do the trick. It seems to just delete the contents of columns B-F (inclusive) in sheet1. Nothing changes in Sheet2

    edit: Attached is a shortened version of the actual workbook I am working on:

    sheet1 is the master list of information, sheet two is the information that needs "filling out"

    You'll notice that a few of the columns in sheet1 are still blank, those will be filled soon. The range of columns and rows varies between different spreadsheets we use.
    Attached Files Attached Files
    Last edited by joekunin; 06-02-2009 at 07:22 AM.

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Pulling Information in seperate sheet based on data in current sheet

    I got the two sheets the wrong way round, but also you changed the layout of your sheet1 data.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    Hmm.. Perhaps I'm simply running the code incorrectly, but I'm still having no luck. It no longer removes those columns, but it doesn't seem to do anything now. Thank you, Stephen, for your patience, by the way.

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Pulling Information in seperate sheet based on data in current sheet

    I think that's because none of the items in sheet2 occur in sheet1! EDIT: have just noticed the sheet2 names have the jpg extension, but sheet1 does not. If that is how things are, the the code will need amending.

  11. #11
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    A Ha! Indeed, the error exists between the keyboard and the chair...

    Let me go find some data that actually works....

  12. #12
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    Alrighty, I grabbed some of the filenames from Column 1 in sheet one and used those as the data for sheet 2. Given that there are no .jpg extensions, it all seems to be peachy!

    Will continue testing further.

  13. #13
    Registered User
    Join Date
    06-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Pulling Information in seperate sheet based on data in current sheet

    It works beautifully. Thanks Stephen. Can't tell you how much time you've saved us!

+ 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