Formula to return tab name if specific value is located within row

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
128
Office Version
  1. 365
Platform
  1. Windows
I have 5 tabs for each weekday, MON, TUE, WED, THU, FRI. In the tab, there are 1s if an employee works that day and 0s if they do not.
1668136578536.png

In tab AGENT, I have a list of all employees down Column B with empty cells in Column C in which I would like to set the formula. Is it possible to create a formula that does the following?

Formula in C2 would do 3 things: 1) Reference B2 for the employee name, 2) check all 5 workday tabs for the John Smith row, and then 3) if John Smith has a 1 in the adjacent cell, the formula would illustrate that he does work that day by populating C2 with M,T,W,T,F (of course, the first letter of each of the 5 tabs). If John Smith does not work on Wednesday, the formula would display MTTF, etc.

Thank you very much in advance!!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about:

Book1
ABC
1
2John SmithMon,Tue,Wed,Thu,Fri
3Brad CooperWed,Thu,Fri
4Mary BradleyWed,Fri
Agent
Cell Formulas
RangeFormula
C2:C4C2=LET(dow,{"Mon","Tue","Wed","Thu","Fri"},TEXTJOIN(",",1,IF(COUNTIFS(INDIRECT(dow&"!A:A"),B2,INDIRECT(dow&"!B:B"),1),dow,"")))


This only checks column B for the 1. I wasn't sure if I needed to check C or D.
 
Upvote 0
How about:

Book1
ABC
1
2John SmithMon,Tue,Wed,Thu,Fri
3Brad CooperWed,Thu,Fri
4Mary BradleyWed,Fri
Agent
Cell Formulas
RangeFormula
C2:C4C2=LET(dow,{"Mon","Tue","Wed","Thu","Fri"},TEXTJOIN(",",1,IF(COUNTIFS(INDIRECT(dow&"!A:A"),B2,INDIRECT(dow&"!B:B"),1),dow,"")))


This only checks column B for the 1. I wasn't sure if I needed to check C or D.
It appears to do the job. There are additional columns I didn't think to add to my question. The C and D could theoretically have a 1 if an agent does come in later to work. All the way to Col R. I tried to adjust your formula. However it returned the #VALUE error.
 
Upvote 0
Looking at other columns actually ramps up the difficulty level quite a bit. You could do something like this:

Book4
ABC
1
2John SmithMon,Tue,Wed,Thu,Fri
3Brad CooperTue,Thu
4Mary BradleyMon,Tue,Wed,Fri
Agent
Cell Formulas
RangeFormula
C2:C4C2=LET(dow,{"Mon","Tue","Wed","Thu","Fri"},ma,MATCH(B2,Mon!$A:$A,0),mb,MATCH(B2,Tue!$A:$A,0),mc,MATCH(B2,Wed!$A:$A,0),md,MATCH(B2,Thu!$A:$A,0),me,MATCH(B2,Fri!$A:$A,0),sa,SUM(INDEX(Mon!$B:$R,ma,0)),sb,SUM(INDEX(Tue!$B:$R,mb,0)),sc,SUM(INDEX(Wed!$B:$R,mc,0)),sd,SUM(INDEX(Thu!$B:$R,md,0)),se,SUM(INDEX(Fri!$B:$R,me,0)),c,CHOOSE({1,2,3,4,5},sa,sb,sc,sd,se),TEXTJOIN(",",1,IF(c,dow,"")))


I came up with a shorter formula, but it was more complicated. There was a short but noticeable lag when changing data, and I only had 3 rows. It would probably be worse for more rows. It's also possible that some of the newer functions such as HSTACK might simplify things, but I don't have those yet to play with. Maybe someone else could chime in.
 
Upvote 0
Solution
Looking at other columns actually ramps up the difficulty level quite a bit. You could do something like this:

Book4
ABC
1
2John SmithMon,Tue,Wed,Thu,Fri
3Brad CooperTue,Thu
4Mary BradleyMon,Tue,Wed,Fri
Agent
Cell Formulas
RangeFormula
C2:C4C2=LET(dow,{"Mon","Tue","Wed","Thu","Fri"},ma,MATCH(B2,Mon!$A:$A,0),mb,MATCH(B2,Tue!$A:$A,0),mc,MATCH(B2,Wed!$A:$A,0),md,MATCH(B2,Thu!$A:$A,0),me,MATCH(B2,Fri!$A:$A,0),sa,SUM(INDEX(Mon!$B:$R,ma,0)),sb,SUM(INDEX(Tue!$B:$R,mb,0)),sc,SUM(INDEX(Wed!$B:$R,mc,0)),sd,SUM(INDEX(Thu!$B:$R,md,0)),se,SUM(INDEX(Fri!$B:$R,me,0)),c,CHOOSE({1,2,3,4,5},sa,sb,sc,sd,se),TEXTJOIN(",",1,IF(c,dow,"")))


I came up with a shorter formula, but it was more complicated. There was a short but noticeable lag when changing data, and I only had 3 rows. It would probably be worse for more rows. It's also possible that some of the newer functions such as HSTACK might simplify things, but I don't have those yet to play with. Maybe someone else could chime in.
Thank you very much Eric! That did it!! Such a long and complex formula I'd have never done it alone. Thank you again!!
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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