lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I want to make my match() and Index() look more dynamic.
User is going to select name from a Data validation list
Then user will Select from another data validation list to tell excel what they want to return, Phone#, Address, or Salary
I can do the lookup if the column is fixed (col1, 2, 3) like the following
=INDEX($A$1:$D$20,MATCH($H$5,$A$1:$A$20,0),2)
That is to return phone# but I like to make it dynamic, I do not want to pass col2 to Index function. Is that possible? Thank you.
[TABLE="class: grid, width: 137"]
<tbody>[TR]
[TD]select name[/TD]
[/TR]
[TR]
[TD]john16[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]enter what you want[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid, width: 256"]
<tbody>[TR]
[TD="width: 64"]name[/TD]
[TD="width: 64"]ph#[/TD]
[TD="width: 64"]address[/TD]
[TD="width: 64"]salary[/TD]
[/TR]
[TR]
[TD]john1[/TD]
[TD="align: right"]1[/TD]
[TD]1 main st[/TD]
[TD="align: right"]2472[/TD]
[/TR]
[TR]
[TD]john2[/TD]
[TD="align: right"]2[/TD]
[TD]2 main st[/TD]
[TD="align: right"]8646[/TD]
[/TR]
[TR]
[TD]john3[/TD]
[TD="align: right"]3[/TD]
[TD]3 main st[/TD]
[TD="align: right"]1156[/TD]
[/TR]
[TR]
[TD]john4[/TD]
[TD="align: right"]4[/TD]
[TD]4 main st[/TD]
[TD="align: right"]9592[/TD]
[/TR]
[TR]
[TD]john5[/TD]
[TD="align: right"]5[/TD]
[TD]5 main st[/TD]
[TD="align: right"]2862[/TD]
[/TR]
[TR]
[TD]john6[/TD]
[TD="align: right"]6[/TD]
[TD]6 main st[/TD]
[TD="align: right"]2155[/TD]
[/TR]
[TR]
[TD]john7[/TD]
[TD="align: right"]7[/TD]
[TD]7 main st[/TD]
[TD="align: right"]4604[/TD]
[/TR]
</tbody>[/TABLE]
I want to make my match() and Index() look more dynamic.
User is going to select name from a Data validation list
Then user will Select from another data validation list to tell excel what they want to return, Phone#, Address, or Salary
I can do the lookup if the column is fixed (col1, 2, 3) like the following
=INDEX($A$1:$D$20,MATCH($H$5,$A$1:$A$20,0),2)
That is to return phone# but I like to make it dynamic, I do not want to pass col2 to Index function. Is that possible? Thank you.
[TABLE="class: grid, width: 137"]
<tbody>[TR]
[TD]select name[/TD]
[/TR]
[TR]
[TD]john16[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]enter what you want[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid, width: 256"]
<tbody>[TR]
[TD="width: 64"]name[/TD]
[TD="width: 64"]ph#[/TD]
[TD="width: 64"]address[/TD]
[TD="width: 64"]salary[/TD]
[/TR]
[TR]
[TD]john1[/TD]
[TD="align: right"]1[/TD]
[TD]1 main st[/TD]
[TD="align: right"]2472[/TD]
[/TR]
[TR]
[TD]john2[/TD]
[TD="align: right"]2[/TD]
[TD]2 main st[/TD]
[TD="align: right"]8646[/TD]
[/TR]
[TR]
[TD]john3[/TD]
[TD="align: right"]3[/TD]
[TD]3 main st[/TD]
[TD="align: right"]1156[/TD]
[/TR]
[TR]
[TD]john4[/TD]
[TD="align: right"]4[/TD]
[TD]4 main st[/TD]
[TD="align: right"]9592[/TD]
[/TR]
[TR]
[TD]john5[/TD]
[TD="align: right"]5[/TD]
[TD]5 main st[/TD]
[TD="align: right"]2862[/TD]
[/TR]
[TR]
[TD]john6[/TD]
[TD="align: right"]6[/TD]
[TD]6 main st[/TD]
[TD="align: right"]2155[/TD]
[/TR]
[TR]
[TD]john7[/TD]
[TD="align: right"]7[/TD]
[TD]7 main st[/TD]
[TD="align: right"]4604[/TD]
[/TR]
</tbody>[/TABLE]
Last edited: