Create formula from cell value

henryg

Board Regular
Joined
Oct 23, 2008
Messages
145
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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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