Archive of Mr Excel Message Board
Back to Forms in Excel VBA archive index
Back to archive home
VLOOKUP - using two variable fieldsPosted by Connie on June 15, 2001 6:35 AM
I have a user form that I want VLOOKUP to fill-in based on two fields which can vary. My fields (columns) are: Political Issue Name, Issue Explanation, Our Candidate's Viewpoint, Our Candidate's Voting Record, Opponent's Name, Opponent's Viewpoint, Opponent's Voting Record.
The first field that can vary on the user form is Political Issue Name. The issue is pulled onto the user form from selections made by user on a previous sheet. So, on the user sheet, the Issue Name might be IssueA or IssueB or IssueC, etc.
The next field that can vary is Opponent's Name. This is done with a drop-down list so that the user can choose which opponent they want to examine. From here, I'd like the user form to automatically fill-in the remaining fields such as voting record, candidate's position, etc.
This is where I'm stuck. I can use VLOOKUP by putting Issue Name in the first column, but how do I accommodate the opponent's name which can change? I could put each opponent's name in separate columns, but then, how in the formula do I tell it which column to look in since the user can choose any one from the drop-down list? I also tried to use Match and Index but I couldn't get that to work either (mainly because I don't know what I'm doing!).
Any ideas appreciated,
|Check out our Excel Resources
Re: VLOOKUP - using two variable fieldsPosted by Aladin Akyurek on June 15, 2001 7:17 AM
The answer depends partly on how you organized your data. Send or post a (cooked up) snippet if you wish.
Re: VLOOKUP - using two variable fieldsPosted by AB on June 15, 2001 7:45 AM
There are some multi-lookup examples on my website that show how you can use concatenation to combine multiple fields for various types of LOOKUP formulas. Basically you create a new field that is a concatenation of two other fields and use that as the lookup criteria field.
AaronThe Excel Logic Page
This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store
to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.