Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two sheets in my workbook.

Sheet A contains two columns as student Id, student Name Sheet B contains student id,month name and some other columns too. student id is not unique in this sheet.

Now i want to add another column of student name(from sheet a) into sheet B, is it possible that i can write some formula for sheet B that compares the student id columns in both sheets and returns the student name (from sheet A)

share|improve this question

migrated from stackoverflow.com May 18 '11 at 20:35

This question came from our site for professional and enthusiast programmers.

You need to use a =VLOOKUP(lookup_value,table_array,col_index_num,range_lookup):

In sheet B put the following formulae (assuming your student ID is in column A-

=VLOOKUP(A1, Sheet1!A:B, 2, 0)

The first A1 value is the cell that contains the student ID on sheet B. The Range (A:B) is the look table on the first sheet. The 2 is the column from the range (A:B) you want to return. The 0 is the true or false (0=false) this basically means EXACT match.

Hope this helps.

share|improve this answer

If Sheet1 has studentId in column A and name in column B Sheet2 has studentId in column A put this is column B in Sheet 2 (assuming you have a header row):

=IF(Sheet1!A2=A2,Sheet1!B2,)

Basically prepend your cell name with the sheet name and !

share|improve this answer
    
This only works if Column A is identical on both sheets -- unlikely, and not very useful since copy/paste would work in that case. – Excellll Jun 20 '11 at 21:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .