As others have mentioned in the comments, this is a simple use case for VLOOKUP. Here's an example. I used a sheet titled "Lookups" to hold the list of numbers/parts, and "Sheet1" to hold the list that references the table. Lookups is a simple sheet that just holds the data, without any formulas:
Sheet is also simple, and contains a simple VLOOKUP call:
The formula (=VLOOKUP(A2, Lookups!$A$2:$B$6, 2, FALSE)
) is straightforward. In the table defined in Lookups!$A$2:$B$6
(which excludes the column headers, although this isn't strictly necessary), VLOOKUP finds the row whose first element matches the value in A2
, and returns the value in the column specified by the third argument, which in this case is the column containing the part name. The boolean argument FALSE
tells Excel to perform an exact match, so if you enter data in column A that isn't found in the table, e.g. "10", as I've done, Excel will return #N/A
instead of the last value in the table.
This exact formula does what you're looking for. The error you mentioned in the comment sounds like you may have some data validation problems or an older version of Excel, but without more details, I can't address that part of your question.
So you have a table that has the name and number in it. Then you want to make a table with the name and number in it. Does this seem a little redundant to you? – EBGreen – 2013-10-02T15:07:09.583
Aaah...so you want to do this in an excel worksheet not a DB table. That is a different question altogether. – EBGreen – 2013-10-02T15:25:18.103
i want to be able to enter the number and it automatic pull up the name of whatever part# i put in. there maybe multiple jobs with the same part, but they have different info attached. so i made a list of numbers and associated names on a different sheet. is there a way to attach them? – ben – 2013-10-02T16:08:11.690
What do you mean by "database"? Just a new table in your workbook? Or a relational database like Access or MySQL? Please provide more detail because, as is, it's really unclear what you're trying to do. – Excellll – 2013-10-02T16:24:44.393
sorry, i made a table in excel that i can add items to for my job. on a separate sheet i have a list of associated part # and part Names. on the first sheet i enter the job #, then the part #, then i want excel to automatically pull the part name from the other sheet. is that possible? – ben – 2013-10-02T16:31:13.137
will the VLOOKUP function work for you, or do you want to use VBA? – datatoo – 2013-10-02T16:40:33.960
i dont know what either of those are but iwill see if they do it and get back to you thank you – ben – 2013-10-02T16:52:18.310
ok VLOOKUP is great except every time i try to input the formula, i get an error message, "you may not use references to other worksheets or workbooks for calculated column criteria" anyone know how to get around this? thank you so much! – ben – 2013-10-02T17:49:34.723
@ben What version of Excel are you using? You may be seeing this error if you're using a version of Excel before 2010.
– John Bensin – 2013-10-02T20:52:40.727