Vlookup based on cell content

AngleseyExcel

New Member
Joined
Feb 4, 2021
Messages
36
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
=VLOOKUP(AA10,'Week 52'!$F$8:$F$105,1,0)

i'm using the above to check that selection on sheet 'Week 52'. but i want it to be dependent on whichever week number is in a certain cell. not fixed on one single sheet.

Can anyone give me any pointers on how this would be done ?
 

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.
use an indirect() to get the TEXT week 52 from a cell

so would this be just a number or the full text week #number

=VLOOKUP(AA10,INDIRECT("'"&F1&"'!$F$8:$F$105"),1,0)

I have changed to use A10 in example


Book5
ABCDEF
1week 52
2Orginal
311
4
5
6
7
8
9
101
11
Sheet1
Cell Formulas
RangeFormula
D3D3=VLOOKUP(A10,'week 52'!$F$8:$F$105,1,0)
F3F3=VLOOKUP(A10,INDIRECT("'"&F1&"'!$F$8:$F$105"),1,0)
 
Upvote 0
You would need to use INDIRECT for that, although as you're only validating existence I would use it with countif instead of vlookup, should be slightly more efficient if the formula is being used in a large number of cells.
Excel Formula:
=IF(COUNTIFS(INDIRECT("'Week "&A1&"'!$F$8:$F$105"),AA10),AA10,"")
If the sheets for weeks 1 to 9 are named as Week 01 etc, rather than Week 1 then you would need to use &TEXT(A1,"00")& instead of &A1&
 
Upvote 0
use an indirect() to get the TEXT week 52 from a cell

so would this be just a number or the full text week #number

=VLOOKUP(AA10,INDIRECT("'"&F1&"'!$F$8:$F$105"),1,0)

I have changed to use A10 in example


Book5
ABCDEF
1week 52
2Orginal
311
4
5
6
7
8
9
101
11
Sheet1
Cell Formulas
RangeFormula
D3D3=VLOOKUP(A10,'week 52'!$F$8:$F$105,1,0)
F3F3=VLOOKUP(A10,INDIRECT("'"&F1&"'!$F$8:$F$105"),1,0)
I've tried using the Indirect, but it either returns #Value! or #N/A not sure why ?
 
Upvote 0
Just a quick idea, but is it possible to get the indirect to work off a selection in a combo box, instead of the content of a cell ?
 
Upvote 0
Not sure about using a combo box, been years since i played with forms or vba , in the early 90's

so the vlookup you have actually does return a value , if its hard coded without the indirect ?

lets see the formula
and what cells are referenced
ideally using XL2BB - see signature
Or on a share like dropbox or onedrive
 
Upvote 0
Not sure about using a combo box, been years since i played with forms or vba , in the early 90's

so the vlookup you have actually does return a value , if its hard coded without the indirect ?

lets see the formula
and what cells are referenced
ideally using XL2BB - see signature
Or on a share like dropbox or onedrive
is there any way i could send you a sample excel file ? and i'll explain what i;m trying to do ?
 
Upvote 0
we are not allowed to work offline here i'm afraid
you can add a sample file, with no personal data here, via a dropbox or onedrive link

OR better still install the XL2BB addin and post here
 
Last edited:
Upvote 0
I've tried using the Indirect, but it either returns #Value! or #N/A not sure why ?
If INDIRECT was the root cause of the error then it would be #REF!

#N/A means that there is no match for the lookup criteria in the range specified.
There is no reason for any of the suggestions provided to return a #VALUE! error unless there is an existing error in your data.
Just a quick idea, but is it possible to get the indirect to work off a selection in a combo box, instead of the content of a cell ?
If you want the sheet names as a dropdown so that you don't have to type them, data validation would be a preferable choice.
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,367
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