Change Sheet Name in a formula

ravibhatu

New Member
Joined
Apr 16, 2011
Messages
3
Hello,

If I have the following formula, how would I be able to change the sheet name to something that is in cell M2. M2 will have either Week 1, Week2, Week 3, Week 4 or Week5

=VLOOKUP(A4,'Week 1'!B:L,5,0)

Any help would be highly appreciated.

Thank you in advance

Ravi
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hello,

If I have the following formula, how would I be able to change the sheet name to something that is in cell M2. M2 will have either Week 1, Week2, Week 3, Week 4 or Week5

=VLOOKUP(A4,'Week 1'!B:L,5,0)

Any help would be highly appreciated.

Thank you in advance

Ravi
Try it like this...

=VLOOKUP(A4,INDIRECT("'"&M2&"'!B:L"),5,0)
 
Upvote 0
One further suggestion I would make is to not have 11 columns (B:L) in your lookup range when you are only using 5 as this can lead to the sheet re-calculating more often than is necessary. So..

=VLOOKUP(A4,INDIRECT("'"&M2&"'!B:F"),5,0)
 
Upvote 0
Thanks for your help Biff & Peter. The formula works properly.

Now I am getting greedy :biggrin:

if i have this formula, how to do i get INDIRECT for work for me. I want to change the sheet name (Week 1) to whatever is in M2

='Week 1'!$E$13

I tired using the formula you gave before, meaning replacing 'Week 1'! with INDIRECT("'"&$M$2&"'!$E$13") but it didnt work.

Thanks in advance once again.

Regards

Ravi
 
Upvote 0
Thanks for your help Biff & Peter. The formula works properly.

Now I am getting greedy :biggrin:

if i have this formula, how to do i get INDIRECT for work for me. I want to change the sheet name (Week 1) to whatever is in M2

='Week 1'!$E$13

I tired using the formula you gave before, meaning replacing 'Week 1'! with INDIRECT("'"&$M$2&"'!$E$13") but it didnt work.

Thanks in advance once again.

Regards

Ravi
That should work. It works for me.

If M2 = Week 1 then the formula evaluates to:

='Week 1'!$E$13

If M2 = Week 2 then the formula evaluates to:

='Week 2'!$E$13

Just a minor tweak:

=INDIRECT("'"&$M$2&"'!E13")

When you quote the cell reference then there's no need to use the $ dollar signs for absolute referencing. The quoted string will automatically be evaluated as an absolute reference.
 
Upvote 0
Now I am getting greedy :biggrin:
I don't know how many INDIRECT formulas you intend to use but just a word of warning before you get too excited about INDIRECT and start using it everywhere. INDIRECT is a volatile function so it can slow your sheet performance if used a lot in a sheet.
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,504
Members
452,917
Latest member
MrsMSalt

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