Auto Populate Cells

shanealbrandt

New Member
Joined
Aug 12, 2008
Messages
25
Hi, I have two columns in my spreadsheet - one that lists employeeID and the other lists Employee Name. I am creating a drop down lists so employees can select their manager. I would like for Excel to auto populate the manager's employeeID when someone selects their name.

Can someone assist?

The columns look like this:
ColumnA (Name)
Smith, Jane
Smith, John
Smith, Michael

ColumnB (EmplID)
123456
123457
123458

I would like that if someone selects Jane Smith, the next cell is auto populated with 123456 - Jane's employee ID.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
VLOOKUP would be one option to do this.

Have a look at the Help files and post back with your attempt.
 
Upvote 0
Hmm...I can usually figure out how to do a VLOOKUP, however here is what I've done.

Using Validation, I created a drop down list for people to select a name, then what I was hoping is that when they select a name from the drop down list....another column would auto populate that name's employeeID.

I don't know how to create the VLOOKUP in combination with the drop down list.

Can someone help?
 
Upvote 0
Welcome to the Board!

Here's an example using VLOOKUP & INDEX/MATCH:
Book1
ABCD
1NameEmp ID
2Smith, Jane123456
3Smith, John123457
4Smith, Michael123458
5
6Validation
7Smith, John123457INDEX/MATCH
8Smith, John123457VLOOKUP
Sheet1


Hope that helps,
 
Upvote 0
Wow....now I am more confused than I was before. LOL!! Sorry I may be more of a novice than I sounded at first. Is there any way to attach my spreadsheet as a file to this thread so someone can get an idea of what I am trying to do?

I think once you are able to open it and see it, it will be clearer.

Thoughts?

-S
 
Upvote 0
What Smitty was trying to show you is:

You would have to have your list of employess and their ID #'s set up somewhere.

Set up your Data Validation for the cell that you want your drop down to be in. Which you already say that you can do.

Next to the cell with your drop down you enter one or the other formulas as posted by Smitty. Of course you may have to adjust the ranges to fit where your list is located.

Harry

EDIT: After relooking at your thread, Smitty has set up the list as you have posted, Col A & B
 
Upvote 0
Perfect! Thank you very much, I got it to work. Now one final question....

Until you select a name from the drop down, the EmplID colum says "#NA". Is there a way around this? Is there a way to just have it appear blank, and then when you make your slection of name, it populates the EmplID field?
 
Upvote 0
You can use =IF(ISNA(VLOOKUP(),"",VLOOKUP), which can be kind of expensive because it forces 2x calculation, or better yet, you can test the validation cell itself:

=IF(ValidationCell="","",VLOOKUP())

Which says: if the validation cell equals nothing, then show nothing, otherwise perform the VLOOKUP.
 
Upvote 0
I don't understand that, so....well moving back to the first problem. When I try to Copy/Paste the formula, it keeps changing the formula contents. I want it to stay the same...FOR THE MOST PART.

Let me explain.....
Formula for first cell is:
=INDEX(E2:E4276,MATCH(L2,F2:F4276,0),0)

Formula for next cell SHOULD BE:
=INDEX(E2:E4276,MATCH(L3,F2:F4276,0),0)

Instead, when I copy/paste it's changing all the variables, instead of just the "L" variable, so it looks like this:
=INDEX(E3:E4277,MATCH(L3,F3:F4277,0),0)

I need all the "E" expressions and "F" expressions to remain the same, only the "L" should be changing. Any ideas?

-S
 
Upvote 0
Take a look at Absolute References in the helpfile.

You can make the references static with $:

=INDEX($E$2:$E$4276,MATCH($L2,$F$2:$F$4276,0),0)

That will allow just the 2 in L2 to change, everything else will stay the same.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

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