Lookup value in table, return the team header above

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
146
Office Version
  1. 365
Platform
  1. Windows
With assistance, I have a formula that returns the supervisor based on the team member name. However, is it possible to reference the team member name and then return the specific team that member is on within the department? I have a cell range with all the team names (P6:P10) but is it possible to reference the agent name, look upwards at the first team header above their name, and return that result?

EX: Bob Smith would be CSR. Wanda Vasquez would be Tier 2.

supervisor lookup:
Excel Formula:
=IFERROR(INDEX(source!$B$2:$Z$2,1,MIN(IF(source!$B$3:$Z$60=A2,COLUMN(source!$B$2:$Z$2)-1))),"")

1713795623547.png
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Better change your structure.
Mappe5
ABC
1TeamRoleName
2ASupervisorJames
3ACSRMary Thomas
4ATier 2Alan Brown
5ATier 3Alex Henry
6ALeadElizabeth Buttons
Tabelle1
 
Upvote 0
First, in future, please post sample data as text, instead of an image. Or, alternatively, use the xl2BB add-in. Otherwise, we won't be able to copy/paste the data into a worksheet for testing purposes. Secondly, it would be a lot easier if you changed your layout, as @shift-del has suggested.

Now, with regards to your current layout, you could probably do something like this (Note that for simplicity, I've included the data and the results on one worksheet, and I've just made up some data. Change the references accordingly.)...

darren.xlsm
ABCDEFGHIJK
1
2James (19A, 19T)Sydney (19A, 19T)QSydney (19A, 19T)Tier 2 (3)
3
4
5CSR (8)CSR (15)
6AN
7BO
8CP
9
10
11
12
13
14Tier 2 (4)
15D
16E
17F
18G
19Tier 3 (6)
20H
21ITier 2 (3)
22JQ
23R
24S
25Lead (1)
26Lead (1)T
27KU
28LV
29M
30
source
Cell Formulas
RangeFormula
J2J2=IFERROR(INDEX(source!$B$2:$G$2,1,SMALL(IF(source!$B$3:$G$60=I2,COLUMN(source!$B$2:$G$2)-COLUMN(source!$B$2)+1),1)),"")
K2K2=LET(col,INDEX(source!$B$3:$G$60,0,MATCH(J2,$B$2:$G$2,0)),INDEX(col,LARGE(IF(ROW(col)-MIN(ROW(col))+1<MATCH(I2,col,0),IF(ISNUMBER(SEARCH("(*)",col)),ROW(col)-MIN(ROW(col))+1)),1)))


Hope this helps!
 
Upvote 0
Better change your structure.
Mappe5
ABC
1TeamRoleName
2ASupervisorJames
3ACSRMary Thomas
4ATier 2Alan Brown
5ATier 3Alex Henry
6ALeadElizabeth Buttons
Tabelle1
Yes I'm sure that would alleviate the headache. I'm trying to work off of my supervisor's formatting so I had hoped to maintain the design as closely as possible and build around that
 
Upvote 0
If you want to lookup data then it is the best structure. And it is scalable.
 
Upvote 0
First, in future, please post sample data as text, instead of an image. Or, alternatively, use the xl2BB add-in. Otherwise, we won't be able to copy/paste the data into a worksheet for testing purposes. Secondly, it would be a lot easier if you changed your layout, as @shift-del has suggested.

Now, with regards to your current layout, you could probably do something like this (Note that for simplicity, I've included the data and the results on one worksheet, and I've just made up some data. Change the references accordingly.)...

darren.xlsm
ABCDEFGHIJK
1
2James (19A, 19T)Sydney (19A, 19T)QSydney (19A, 19T)Tier 2 (3)
3
4
5CSR (8)CSR (15)
6AN
7BO
8CP
9
10
11
12
13
14Tier 2 (4)
15D
16E
17F
18G
19Tier 3 (6)
20H
21ITier 2 (3)
22JQ
23R
24S
25Lead (1)
26Lead (1)T
27KU
28LV
29M
30
source
Cell Formulas
RangeFormula
J2J2=IFERROR(INDEX(source!$B$2:$G$2,1,SMALL(IF(source!$B$3:$G$60=I2,COLUMN(source!$B$2:$G$2)-COLUMN(source!$B$2)+1),1)),"")
K2K2=LET(col,INDEX(source!$B$3:$G$60,0,MATCH(J2,$B$2:$G$2,0)),INDEX(col,LARGE(IF(ROW(col)-MIN(ROW(col))+1<MATCH(I2,col,0),IF(ISNUMBER(SEARCH("(*)",col)),ROW(col)-MIN(ROW(col))+1)),1)))


Hope this helps!
Going to work on this. As of now I'm getting a #NUM error for the K2 formula Not sure why. it works with the dummy info if I set everything up on 1 worksheet. But when I start referencing the other worksheet and putting in real names, it's not calculating the same thing and displaying an error instead. Also, not sure it matters, but the (19a, 19t) data is not the same cell as the supervisor name, it's technically a different cell. That's because of my copy/paste image. Sorry about that. I'd like to use xl2BB but IT has my system locked down and I can't use any add-ins.
 
Last edited:
Upvote 0
Can you post a representative sample of your data (the two supervisers) as text?
 
Upvote 0
Can you post a representative sample of your data (the two supervisers) as text?
The data below would all appear in the source tab. Disregard the numbers in parentheses as those are formulas that aren't part of this inquiry. I think the previous formulas work but I believe they're looking for data with numbers. If Kim Frost was referenced on the 'lookout' tab, it would fine her name, look directly up and reference the first "team header" it comes across (CSR in this case).

A​
B​
C​
D​
E​
F​
G​
James(19a, 19t)Sydney(19a, 19t)
CSR​
(8)
CSR​
(15)
Mary ThomasBrittany Black
Joe FlemingAaron Alexander
William JenkinsPatty Ames
Kim FrostAngela Turner
Jeff SobchakJohn Washington
Alexis WarrenHeather Wright
Perry ThornCandice Abbott
Bob SmithLynn Lucas
Tier 2​
(4)Michelle Nelson
Whitney JonesTamara Davis
Alan BrownDevin Flores
Joan bellTony Miller
Karen SanchezDebbie Moore
Tier 3​
(6)Rose Smith
Wendy SmithGary Wright
Alex Henry
Tier 2​
(3)
Christine JamesShannon Fuller
Bill BensonSierra Ortiz
Carla WilliamsWanda Vasquez
Alicia Stone
Lead​
(1)
Lead​
(1)Sara Sutton
Elizabeth Buttons
 
Upvote 0
The issue is that CSR (8), and others alike, actually resides in two separate cells, CSR in one and (8) in another. In that case, try the following instead...

darren.xlsm
ABCDEFGHIJK
1James(19a, 19t)Sydney(19a, 19t)Sierra OrtizSydneyTier 2
2
3
4CSR(8)CSR(15)
5Mary ThomasBrittany Black
6Joe FlemingAaron Alexander
7William JenkinsPatty Ames
8Kim FrostAngela Turner
9Jeff SobchakJohn Washington
10Alexis WarrenHeather Wright
11Perry ThornCandice Abbott
12Bob SmithLynn Lucas
13Tier 2(4)Michelle Nelson
14Whitney JonesTamara Davis
15Alan BrownDevin Flores
16Joan bellTony Miller
17Karen SanchezDebbie Moore
18Tier 3(6)Rose Smith
19Wendy SmithGary Wright
20Alex HenryTier 2(3)
21Christine JamesShannon Fuller
22Bill BensonSierra Ortiz
23Carla WilliamsWanda Vasquez
24Alicia StoneLead(1)
25Lead(1)Sara Sutton
26Elizabeth Buttons
source
Cell Formulas
RangeFormula
J1J1=IF(LEN(I1)>0,IFERROR(INDEX(source!$B$1:$G$1,1,SMALL(IF(source!$B$2:$G$60=I1,COLUMN(source!$B$1:$G$1)-COLUMN(source!$B$1)+1),1)),""),"")
K1K1=IF(LEN(J1)>0,LET(col,INDEX(source!$B$2:$G$60,0,MATCH(J1,$B$1:$G$1,0)),INDEX(col,LARGE(IF(ROW(col)-MIN(ROW(col))+1<MATCH(I1,col,0),IF(ISNUMBER(MATCH(col,{"CSR","Tier 2","Tier 3","Lead"},0)),ROW(col)-MIN(ROW(col))+1)),1))),"")


Hope this helps!
 
Upvote 0
Solution
The issue is that CSR (8), and others alike, actually resides in two separate cells, CSR in one and (8) in another. In that case, try the following instead...

darren.xlsm
ABCDEFGHIJK
1James(19a, 19t)Sydney(19a, 19t)Sierra OrtizSydneyTier 2
2
3
4CSR(8)CSR(15)
5Mary ThomasBrittany Black
6Joe FlemingAaron Alexander
7William JenkinsPatty Ames
8Kim FrostAngela Turner
9Jeff SobchakJohn Washington
10Alexis WarrenHeather Wright
11Perry ThornCandice Abbott
12Bob SmithLynn Lucas
13Tier 2(4)Michelle Nelson
14Whitney JonesTamara Davis
15Alan BrownDevin Flores
16Joan bellTony Miller
17Karen SanchezDebbie Moore
18Tier 3(6)Rose Smith
19Wendy SmithGary Wright
20Alex HenryTier 2(3)
21Christine JamesShannon Fuller
22Bill BensonSierra Ortiz
23Carla WilliamsWanda Vasquez
24Alicia StoneLead(1)
25Lead(1)Sara Sutton
26Elizabeth Buttons
source
Cell Formulas
RangeFormula
J1J1=IF(LEN(I1)>0,IFERROR(INDEX(source!$B$1:$G$1,1,SMALL(IF(source!$B$2:$G$60=I1,COLUMN(source!$B$1:$G$1)-COLUMN(source!$B$1)+1),1)),""),"")
K1K1=IF(LEN(J1)>0,LET(col,INDEX(source!$B$2:$G$60,0,MATCH(J1,$B$1:$G$1,0)),INDEX(col,LARGE(IF(ROW(col)-MIN(ROW(col))+1<MATCH(I1,col,0),IF(ISNUMBER(MATCH(col,{"CSR","Tier 2","Tier 3","Lead"},0)),ROW(col)-MIN(ROW(col))+1)),1))),"")


Hope this helps!
That works like a charm! Thank you so much for sticking with it. Yes that's perfect and exactly what I was hoping to accomplish!!
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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