convert formula to use dynamic sheet reference

mtk1985

New Member
Joined
Apr 22, 2014
Messages
7
Hi All,

Looking for help to convert this formula to use a dynamic sheet reference in cell B1. I tried it myself but always broke the logical statement in the process.

Here is the working formula (without the dynamic sheet reference)

=INDEX('[agent_raw.xlsx]2.14'!$B:$B,MATCH(MAX(IF('[agent_raw.xlsx]2.14'!$A:$A="MTVSSL",'[agent_raw.xlsx]2.14'!$Z:$Z)),IF('[agent_raw.xlsx]2.14'!$A:$A="MTVSSL",'[agent_raw.xlsx]2.14'!$Z:$Z),0))


  • I have a Combobox with a list of Months. If for example January is selected, cell B1 will contain the dynamic reference 1.14
  • 1.14 stands for January 2014
  • My sheets are labelled as 1.14 etc
  • I need to include a dynamic reference in the formula to change only the sheet name (The workbook names is fixed)

Thanks for your support
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Thank you, managed to work it out few mins ago

=INDEX(INDIRECT("'"&B1&"'!B:B"),MATCH(MAX(IF(INDIRECT("'"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&B1&"'!AJ:AJ"))),IF(INDIRECT("'"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&B1&"'!AJ:AJ")),0))

I am undecided to leave the workbook name in the referencing cell or to have it fixed in the formula reference... looking at how to fix it now but probably will revert back.
 
Upvote 0
All sorted

With Fixed workbook reference:
=INDEX(INDIRECT("'"&"[agent_raw.xlsx]"&B1&"'!B:B"),MATCH(MAX(IF(INDIRECT("'"&"[agent_raw.xlsx]"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&"[agent_raw.xlsx]"&B1&"'!AJ:AJ"))),IF(INDIRECT("'"&"[agent_raw.xlsx]"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&"[agent_raw.xlsx]"&B1&"'!AJ:AJ")),0))

Without Fixed workbook reference:
=INDEX(INDIRECT("'"&B1&"'!B:B"),MATCH(MAX(IF(INDIRECT("'"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&B1&"'!AJ:AJ"))),IF(INDIRECT("'"&B1&"'!A:A")="MTVSSL",INDIRECT("'"&B1&"'!AJ:AJ")),0))
 
Upvote 0

Forum statistics

Threads
1,214,845
Messages
6,121,902
Members
449,053
Latest member
Guy Boot

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