Need help with =if formula

sindel

New Member
Joined
May 13, 2015
Messages
3
Good afternoon,

I'm a total newbie and am struggling with the correct formula to use, so please forgive me.

I have two sheets in a workbook. The first sheet is titled Responses and contains 3 columns: timestamp, Student ID number, and pass type. The second sheet is titled Names and also contains three columns: StudentID, Firstname, Lastname.

What I want to do:
*Enter unique student ID number value in the Student ID number cell on sheet one.
*Excel finds the exact number value on sheet two.
*Excel looks to the left of the matched Student ID, copies the First Name, and Last Name from those columns.
*Displays those retrieved first name and last name values on sheet one.

Basically, I'm trying to create a student pass system where the kids check in by number, and Excel populates their name for them to save time.

I clicked in the Responses sheet, cell D1 and tried the formula =if(Responses!B:B,Names!A:A), but I don't understand how to finish the formula to display the kids' first and last names instead of the text StudentID.

Many thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
hello can yuo post a small sample with the expected outcome!
 
Upvote 0
I've already figured out the timestamp and school portion of sheet one, so please don't focus on those.

Outcome:
Timestamp / ID# / School / First Name / Last Name
09:52am / 20089800 / Washington / Jan / Smith
10:12am / 20074123 / Lewis / Brian /Miller


My second sheet currently contains about 6000 student names arranged by row and is functioning as a quasi-database:
20089800 Jan Smith
20074123 Brian Miller

My problem boils down to... when I type 20089800 (or other unique number) into sheet one, I want the corresponding student's first name and last name to appear in columns D and E of sheet one, respectively.
 
Last edited:
Upvote 0
Copy across!


Book1
ABCDE
1TimestampID#SchoolFirst NameLast Name
209:52am20089800WashingtonJanSmith
309:52am20089801asdfpaoloasf
409:52am20089802afdsafrankasfd
509:52am20089803asdfjoezucca
609:52am20089804asdfluismaryasdf
709:52am20089805asdfmaryasf
809:52am20089806asdfgeorgesadf
909:52am20089807sadfAnnasadf
1009:52am20089808sadmikesad
1109:52am20089809asdfviolasd
1209:52am20089810asdgeradsa
13
14ID#First NameLast Name
1520089803joezucca
Foglio1
Cell Formulas
RangeFormula
B15=INDEX(D$2:D$12,MATCH($A$15,$B$2:$B$12,0))
 
Upvote 0
Thank you for trying to help me. I've learned a great deal trying to work through this.

I was able to get the sheet working with these formulas, just in case anyone has a similar issue:

First name formula (goes in cell D2 of first sheet).
=VLOOKUP(B:B,Names!A2:C6421,2,FALSE)

Last name formula (goes in cell E2 of first sheet).
=VLOOKUP(B:B,Names!A2:C6421,3,FALSE)

For other newbies, B;B refers to the column on my first sheet where the students would input their number. Names!A2:C6421 refers to my second sheet and all the data to be looked through. 2 is the column where the kids' first names can be found on that second sheet, and FALSE means I want an exact student ID number match.
 
Upvote 0
Hello!
with Excel ther's Always more than one way to do the same thing
my INDEX and MATCH formula is another approch
 
Upvote 0
If you are interested there is also a way to have the name shown in the same cell instead of in two separate cells. For example: if you wanted the full name to appear in Sheet One in the D2 where the first name appears you could combine your two VLookUp statements and it would look like this:

=VLOOKUP(B:B,Names!A2:C6421,2,FALSE)&" "&VLOOKUP(B:B,Names!A2:C6421,3,FALSE)

I would make the suggestion to change the area you are referencing in the "Names" sheet to be fixed ($A$2:$C$6421) so that if you copy of fill this formula on the Frist sheet it does not mess up what you are doing by moving your lookup array. OR if you want it open to add more students in the future, then you could do the full columns (with the assumption that rows in Columns A through C will only be used for student info). This would be as simple as this:

=VLOOKUP(B:B,Names!A:C,2,FALSE)&" "&VLOOKUP(B:B,Names!A:C,3,FALSE)

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,835
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top