Can you use a cell as a reference for a table array in a Vlookup formula?

Oakey

New Member
Joined
Jan 9, 2017
Messages
49
Office Version
  1. 365
Im trying to create a daily register for my staff, but each day the teams in will change.

I currently have 7 teams and under these team a list of names.

I have names the teams
AMTeam1
AMTeam2
AMTeam3 etc.

I have the formula that can show the teams that are in on the day but i would like it to show me the name of the staff

In cell B3 and downwards is where i would like the formula, I want the table array to be taken from cell B2 (this will change dependant on the date in cell B1)

1640640340544.png


Below is the table array that i have called AMTeam1
1640640543116.png


Any help will be great.

Thank you Stuart
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi Stuart,

Your challenge with VLOOKUP is that you want the name of the second Moca for the second Moca but VLOOKUP will keep returning the 1st.

You don't say how the date is used so I've mocked up a shift where the WEEKDAY denotes the shift.

Oakey.xlsx
ABCDE
1
2
3AMTeam1AMTeam2AMTeam3AMTeam4
4Shift ManagerMikeMichelleS3S4
5Team LeadersTerry UnoTristan DuoTL3ATL4A
6Team LeadersTammy WanTrieste DeuxTL3B
7MocaMitchMonaMoca3AMoca4A
8MocaMillyMunchMoca3BMoca4B
9MocaMandyMoca3CMoca4C
10
Teams


Cell Formulas
RangeFormula
C1:E1C1=B1+1
B2:E2B2="AMTeam"&WEEKDAY(B$1,2)
B3:E9B3=IFERROR(INDEX(Teams!$B$4:$E$99,AGGREGATE(15,6,ROW(Teams!$A$4:$A$99)-ROW(Teams!$A$3)/((Teams!$A$4:$A$99=$A3)),COUNTIF($A$2:$A3,$A3)),MATCH(B$2,Teams!$B$3:$E$3,0))&"","")
 
Upvote 0
Thank you for your reply.

What if i was to change the titles on the left, so it read something like this?

1640777065135.png


Its the team name that i would like to get into the Vlookup some how, but when it changes i want the formula to also change, is this something that is possible?

A bit more information, i have 7 teams and each day i will have atleast 4 teams in, sometimes 5 and once a week 6.
Id like to change the day and a sheet to appear that would show just the selected trams that are in (names included)

Thanks Stuart
 
Upvote 0
Assuming it's a static named range, you can use INDIRECT(B$2) to get a reference to it.
 
Upvote 0
If you really want to use VLOOKUP then yes, you could add a number to duplicate roles, define the whole Staff table as a single table then use COUNTIF to select which role and the Team number to select which column.

Oakey-v2.xlsx
ABCDE
1
2
3StaffAMTeam1AMTeam2AMTeam3AMTeam4
4Shift ManagerMikeMichelleS3S4
5Team Leader 1Terry UnoTristan DuoTL3ATL4A
6Team Leader 2Tammy WanTrieste DeuxTL3B
7Moca 1MitchMonaMoca3AMoca4A
8Moca 2MillyMunchMoca3BMoca4B
9Moca 3MandyMoca3CMoca4C
10
Teams


Cell Formulas
RangeFormula
C1:E1C1=B1+1
B3:E9B3=IFERROR(VLOOKUP($A3&IF(COUNTIF($A$3:$A$99,$A3)>1," "&COUNTIF($A$2:$A3,$A3),""),Staff,1+B$2,FALSE)&"","")
Named Ranges
NameRefers ToCells
Staff=Teams!$A$3:$E$9B3:E9
 
Upvote 0

Forum statistics

Threads
1,215,842
Messages
6,127,227
Members
449,371
Latest member
strawberrish

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