Change Sheet name in Vlookup when formula copies to right

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,595
Office Version
  1. 2021
Platform
  1. Windows
I have the following Vlookup formula


Code:
=VLOOKUP($A2,'Sept-2018'!C:D,2,FALSE)


I would like to know how to automatically change to the sheet name in the formula when copying the formula to the right for eg 'Oct-2018'!, 'Nov-2018'! etc


Your assistance is most appreciated
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
=VLOOKUP($A2,INDIRECT("'"&TEXT(1+EOMONTH(DATEVALUE("9/1/2018"),COLUMN(A1)-2),"MMM-YYYY")&"'!C:D"),2,FALSE)

works if you change Sept to Sep
 
Upvote 0
Thanks for the help


Please explain this part of the formula to me


Code:
 INDIRECT("'"&TEXT(1+EOMONTH(DATEVALUE("9/1/2018"),COLUMN(A1)-2),"MMM-YYYY")&"'!
 
Upvote 0
To get the date:


Excel 2010
ABCDEFG
3Sep-2018Oct-2018Nov-2018Dec-2018Jan-2019Feb-2019Mar-2019
Sheet3
Cell Formulas
RangeFormula
A3=TEXT(1+EOMONTH(DATEVALUE("9/1/2018"),COLUMN(A1)-2),"MMM-YYYY")


EOMONTH returns the last date of the month:


Excel 2010
ABCDEFG
38/31/20189/30/201810/31/201811/30/201812/31/20181/31/20192/28/2019
Sheet3
Cell Formulas
RangeFormula
A3=EOMONTH(DATEVALUE("9/1/2018"),COLUMN(A1)-2)


Column(A1) will start at 1 and increase by 1 each time you drag right (notice how 2 is subtracted so it starts at -1, i.e. t-1).

The text function converts a date to a string

Indirect converts text to a cell reference that the vlookup can read as such.
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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