#### Archived

This topic is now archived and is closed to further replies.

# Excel database?

## Recommended Posts

Ok, so I want a list of persons, like this:
|Name1|Name2|IDnum|
|Egon |Quist|    1|
|Peter|Pan  |    2|
|Egon |Smith|    3|
|John |Brown|    4| 
Containing the first name, last name, and number (Or perhaps just row number) of some persons. Now I want to make a function so that I can write the name of a person and retrieve his number: |John|Brown| 4|<-- Like this, I write "John" and "Brown" and get "4". How would I go about this?

##### Share on other sites
Hmm, could do with more information as to what you''re trying to achieve here. Are you talking about writing that function in Excel as a formulae, or am I missing the point?

You could do this in Access (or any other database), then use SQL to query the database for the information you''re looking for. An example query might look something like:

"SELECT IDnum FROM persons WHERE Name1 = "John" AND Name2 = "Brown"

You could easily write a wrapper function to do this for you, passing Name1 and Name2 as parameters to the function. Then, depending on if a record was successfully retrieved, you could either return IDnum from the function (as an unsigned integer type, long most likely) or -1 if the record wasn''t found.

Pseudocode
result = getID(Name1, Name2);if (result == -1)  // Record wasn''t found.else  // Record was found.

Hope that helps,

--hellz

##### Share on other sites
Umm, no, it has to be straight MS Excel.
Basically I have a long list of names in an Excel document, and I want to know what row any given name is on.

##### Share on other sites
Ah ok, sorry I can''t help you there then. Been too long since I''ve used Excel. :|

I did find this though, http://www.hotscripts.com/Detailed/23919.html, so maybe you can rip an idea from that?

Either way, good luck with it.

--hellz

VLOOKUP

• ### Forum Statistics

• Total Topics
628320
• Total Posts
2982054

• 11
• 9
• 9
• 13
• 11