+ Reply to Thread
Results 1 to 7 of 7

Look at another spreadsheet and populate values

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Wisconsin
    MS-Off Ver
    Excel 2013
    Posts
    49

    Look at another spreadsheet and populate values

    I am wondering if this is possible... not sure how to categorize it.

    I have an excel spreadsheet where on one tab it lists students and their courses.

    Sheet 1
    Student ID Program Start Date Course ID
    1234567 4533
    1234567 4688
    1234567 4800
    1234567 4300
    2233445 1234
    2233445 3434
    2233445 4300


    On another excel spreadsheet I have the same students but only one entry and listed with different values.

    Sheet 2
    Student ID Program Start Date Active
    1234567 2/2/2015 0
    2233445 5/2/2014 1


    Is it possible to either write a macro or some sort of formula to review the data on Sheet 2 and then populate columns in Sheet 1 (Program Start Date) depending on what it shows on Sheet 2?

    Like for instance for 1234567 the program start date would be 2/2/2015 on sheet 1; 2233445 - Program Start Date = 5/2/2014 and so on.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Look at another spreadsheet and populate values

    Would a VLOOKUP formula work for you?

    I can't tell what columns your data is in.

    For this example, the formula looks up A2 value in column A of Sheet2 and returns the result of the match from Sheet2 column B

    =VLOOKUP(A2,Sheet2!A:B,2,0)
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-24-2015
    Location
    Wisconsin
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Look at another spreadsheet and populate values

    Is it possible to write this in a macro?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Look at another spreadsheet and populate values

    Yes, but you have to better describe your data configuration. Your example isn't formatted well. And include column letters.

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,667

    Re: Look at another spreadsheet and populate values

    Note that you can often use method evaluate to directly write result of a worksheet function in a VBA. Like:

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  6. #6
    Registered User
    Join Date
    06-24-2015
    Location
    Wisconsin
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Look at another spreadsheet and populate values

    I"m getting a Run-time error '13 Type mismatch error for the VBA code below:

    Sub ProgStartDtFill()
    '
    ' Maria Lindquist
    ' 02/15/2016
    ' This macro will match up the Student IDs and populate the Program Start Date as shown on StudentInfo Sheet
    '
    Range("D2").Select
    Dim i As Long
    For i = 2 To Sheets("CrseData").Cells(Rows.Count, "A").End(xlUp).Row
    Sheets("CrseData").Cells(i, "D").Value = Application.Evaluate("=VLOOKUP(" & Sheets("CrseData").Cells(i, "D").Value & ",StudentInfo!A2:AD2,4,0)")
    Next i
    End Sub

    In Column D of CrseData it puts #N/A all the way down.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Look at another spreadsheet and populate values

    1.) The red A is the column that contains the student IDs to be looked up.
    2.) Lookup in the entire column A:AD instead of just A2:AD2

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 02-15-2016 at 10:36 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. Replies: 15
    Last Post: 10-27-2014, 08:45 PM
  2. help with Userform to populate spreadsheet
    By fredgh3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-28-2013, 01:15 AM
  3. [SOLVED] How can I populate col A with the tab name in a spreadsheet
    By kcleere in forum Excel General
    Replies: 3
    Last Post: 09-05-2012, 01:36 PM
  4. Query excel spreadsheet to populate another spreadsheet or worksheet.
    By bsambrano in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2012, 09:03 PM
  5. Populate one spreadsheet from another
    By jvlajcic in forum Excel General
    Replies: 9
    Last Post: 01-24-2012, 02:13 PM
  6. Populate spreadsheet
    By klaphake in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-28-2006, 02:22 PM
  7. [SOLVED] populate a spreadsheet from SQL Server
    By barnwood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2005, 04:05 AM

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