Dynamic Match()/Index() (col changing)

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. 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.

select name
john16
enter what you want

<tbody>
</tbody>

nameph#addresssalary
john111 main st2472
john222 main st8646
john333 main st1156
john444 main st9592
john555 main st2862
john666 main st2155
john777 main st4604

<tbody>
</tbody>
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try this formula

Excel Workbook
ABCDEFGHIJ
1nameph#addresssalary
2john111 main st2472
3john222 main st8646
4john333 main st1156
5john1address1 main st
Hoja12
 
Upvote 0
If in H7 you put a list where user can select Phone, Address or Salary then

Code:
=INDEX($A$1:$D$20,MATCH($H$5,$A$1:$A$20,0),IF($H$7="Phone",2,IF($H$7="Address",3,4)))
 
Last edited:
Upvote 0
withdrawn...Dante has it covered
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

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