Create formula from cell value

henryg

Board Regular
Joined
Oct 23, 2008
Messages
143
Office Version
  1. 365
Platform
  1. Windows
I have a cell with the formula

=XLOOKUP(A7,'Dec20'!A7:A21,'Dec20'!D7:D21)

which I want to change so that the Dec20 part of the formula is derived from a month referenced in another cell eg K1 with 31/01/21

I can get 'Jan21'! via ="'"&TEXT(K1,"mmmyy")&"'!" but I can't manage to successfully concatenate that into the formula to replace 'Dec20'!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How about
Excel Formula:
=XLOOKUP(A7,indirect("'"&TEXT(K1,"mmmyy")&"'!A7:A21"),indirect("'"&TEXT(K1,"mmmyy")&"'!D7:D21"))
 
Upvote 0
Edit.,
Post while I was composing

perhaps an indirect()
=XLOOKUP(A7,INDIRECT("'"&TEXT(K1,"MMMYY")&"'!A7:A21"),INDIRECT("'"&TEXT(K1,"MMMYY")&"'!D7:D21"))
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,205
Members
448,554
Latest member
Gleisner2

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