get table row and column headings based on multiple cells with the same value

TheColonist

New Member
Joined
Jun 23, 2023
Messages
11
Office Version
  1. 365
Platform
  1. Windows
My Table calculates when Progress Reports are due. Those due this week are highlighted in red via conditional formating.
Trying to figure how to list the student name and the report due in one cell on a separate sheet.

Example:
Student 2 PR 5
Student 3 PR 2
Student 5 PR 8
etc.

Many of our instructors are blind, so the current worksheet does not help them. Getting it to list as shown above would allow it to be copied and pasted in an email to alert everyone what reports are do.
I work for a state agency and we are not allowed to use Macros, so no VB code.
Using Office 365 on Windows 10
Staffing Schedule Calculator.png
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Here is one approach. Note that I first create a list of students meeting the date criterion anywhere on their row, then the specific reports are listed beside their name. To illustrate what happens should multiple reports be due for one student, I changed the yellow cell from 7/21/2023 to a date that fell within the week given in cell N1 (so that two reports are due for Student 2).
Staffing Schedule Calculator.xlsx
ABCDEFGHIJKLMN
1Week beginning:6/18/2023
2
3StudentProgramAssessment BeginsStaffing ICPTraining BeginsPR 1PR 2PR 3PR 4PR 5PR 6Reports Due:
4Student 1VISP1/9/20231/20/20231/23/20232/17/20233/17/20234/14/20235/12/20236/9/20237/7/2023Student 2PR 5, PR 6
5Student 2VISP1/23/20232/3/20232/6/20233/3/20233/31/20234/28/20235/26/20236/23/20236/23/2023Student 3PR 2
6Student 3VISP4/17/20234/28/20235/1/20235/26/20236/23/20237/21/20238/18/20239/15/202310/13/2023Student 10Staffing ICP
7Student 4VISP3/6/20233/17/20233/20/20234/14/20235/12/20236/9/20237/7/20238/4/20239/1/2023Student 15Staffing ICP
8Student 5AT10/31/202211/11/202211/14/202212/9/20221/6/20232/3/20233/3/20233/31/20234/28/2023Student 18PR 1
9Student 6 AT7/11/20227/22/20227/25/20228/19/20229/16/202210/14/202211/11/202212/9/20221/6/2023
10Student 7AT4/4/20224/15/20224/18/20225/13/20226/10/20227/8/20228/5/20229/2/20229/30/2022
11Student 8VISP4/3/20234/14/20234/17/20235/12/20236/9/20237/7/20238/4/20239/1/20239/29/2023
12Student 9VISP6/2/20236/13/20236/16/20237/13/20238/10/20239/7/202310/5/202311/2/202312/7/2023
13Student 10VISP6/12/20236/23/20236/26/20237/21/20238/18/20239/15/202310/13/202311/10/202312/15/2023
14Student 11VISP8/8/20228/19/20228/22/20229/16/202210/14/202211/11/202212/9/20221/6/20232/3/2023
15Student 12VISP8/8/20228/19/20228/22/20229/16/202210/14/202211/11/202212/9/20221/6/20232/3/2023
16Student 13AT10/3/202210/14/202210/17/202211/11/202212/9/20221/6/20232/3/20233/3/20233/31/2023
17Student 14VISP1/9/20231/20/20231/23/20232/17/20233/17/20234/14/20235/12/20236/9/20237/7/2023
18Student 15VISP6/12/20236/23/20236/26/20237/21/20238/18/20239/15/202310/13/202311/10/202312/15/2023
19Student 16AT10/13/202210/24/202210/27/202211/23/202212/21/20221/18/20232/15/20233/15/20234/12/2023
20Student 17VISP10/17/202210/28/202210/31/202211/25/202212/23/20221/20/20232/17/20233/17/20234/14/2023
21Student 18VISP5/15/20235/26/20235/29/20236/23/20237/21/20238/18/20239/15/202310/13/202311/10/2023
22Student 19VISP4/3/20234/14/20234/17/20235/12/20236/9/20237/7/20238/4/20239/1/20239/29/2023
23Student 20VISP5/1/20235/12/20235/15/20236/9/20237/7/20238/4/20239/1/20239/29/202310/27/2023
24Student 21VISP5/30/20236/10/20236/13/20237/10/20238/7/20239/4/202310/2/202310/30/202312/4/2023
Sheet1
Cell Formulas
RangeFormula
M4:M8M4=FILTER($A$4:$A$24,BYROW(($C$4:$K$24-$N$1<=6)*($C$4:$K$24-$N$1>=0),LAMBDA(x,SUM(x)))>0)
N4:N8N4=TEXTJOIN(", ",TRUE,FILTER($C$3:$K$3,FILTER(($C$4:$K$24-$N$1<=6)*($C$4:$K$24-$N$1>=0),$A$4:$A$24=M4)=1))
Dynamic array formulas.
 
Upvote 0
Fantastic! New to the Filter function, but love it. I figured the N4 formula would contain nested Filters. Had to familiarize myself with LAMBDA and BYROW.
Thanks for the help!
 
Upvote 0
Glad to help. The ($C$4:$K$24-$N$1<=6)*($C$4:$K$24-$N$1>=0) part of the formula creates an array that mirrors the data table in $C$4:$K$24, except each entry assumes the value of either 1 or 0 to indicate whether the entry is within the next six days of the "week beginning" date in $N$1. The 1's and 0's are formed because the TRUEs and FALSEs returned by the logical checks are coerced to 1's and 0's when the arrays are multiplied together. We'll use this two-dimensional array of 1's and 0's to determine which rows have at least one "1" in them...those are the rows of interest.

The BYROW function accepts a LAMBDA function as one of it's arguments. So we feed the two-dimensional array of 1's and 0's to the BYROW function, and BYROW takes one row at a time and feeds it to the LAMBDA function (so each row is treated as "x" in the LAMBDA function), and then that x (that row) is summed (the SUM(x) component in the LAMBDA function). So if you have two reports due within the next week for a given student, this expression will evaluate to 2 (i.e., if we were to look across this row in the two-dimensional array of 1's and 0's, we would find two 1's corresponding to dates that are within the next 6 days of the "week beginning" date in $N$1). We care about identifying any rows where this sum is >0, which is the criteria used by FILTER for trimming down the list of students in $A$4:$A$24.

The "old school" approach to summing across each row involves some linear algebra using the MMULT function. Here is a comparison of the two, operating on the two dimensional array of 1's and 0's:
Staffing Schedule Calculator.xlsx
QRSTUVWXYZAAABAC
3ABSICPTBPR1PR2PR3PR4PR5PR6
4Student 100000000000
5Student 200000001122
6Student 300001000011
7Student 400000000000
8Student 500000000000
9Student 6 00000000000
10Student 700000000000
11Student 800000000000
12Student 900000000000
13Student 1001000000011
14Student 1100000000000
15Student 1200000000000
16Student 1300000000000
17Student 1400000000000
18Student 1501000000011
19Student 1600000000000
20Student 1700000000000
21Student 1800010000011
22Student 1900000000000
23Student 2000000000000
24Student 2100000000000
Sheet1
Cell Formulas
RangeFormula
R4:Z24R4=(C4:K24-$N$1<=6)*(C4:K24-$N$1>=0)
AB4:AB24AB4=BYROW(R4#,LAMBDA(x,SUM(x)))
AC4:AC24AC4=MMULT($R$4:$Z$24,TRANSPOSE(COLUMN(R3:Z3)^0))
Q4:Q24Q4=A4
Dynamic array formulas.
 
Upvote 0
I got the output I wanted before I posted, but hoped for more compact formulas, like what you did. Here is what I came up with:

For the Student name: (messy, but it works)

=FILTER(Table1[Student],
(Table1[Staffing ICP]=$A$2)+
(Table1[PR 1]=$A$2)+
(Table1[PR 2]=$A$2)+
(Table1[PR 3]=$A$2)+
(Table1[PR 4]=$A$2)+
(Table1[PR 5]=$A$2)+
(Table1[PR 6]=$A$2),"")

For the Report Due: (got this from a YouTube video)

=IF(A4="","",INDEX(Table1[[#Headers],[Staffing ICP]:[PR 10]],,
MATCH($A$2,INDEX(Table1[[Staffing ICP]:[PR 10]],
MATCH(A4,Table1[Student],0),),0)))

I like yours and will play with it to make it work for me.
Thanks for your help KRice
 

Attachments

  • Staffing Schedule Output.png
    Staffing Schedule Output.png
    22.6 KB · Views: 6
Upvote 0
Here is a version that uses a formal named table (Table1) as suggested in your last post. Will there every be occasions where more than one report is due for a given student...as I've shown for Student 2 in this example? I ask because the MATCH function you've described will find only the first match, but not all of them if there are multiple reports for a student.
Staffing Schedule Calculator.xlsx
ABCDEFGHIJKLMN
1Due Week of:
26/18/2023
3StudentProgramAssessment BeginsStaffing ICPTraining BeginsPR 1PR 2PR 3PR 4PR 5PR 6StudentReport
4Student 1VISP1/9/20231/20/20231/23/20232/17/20233/17/20234/14/20235/12/20236/9/20237/7/2023Student 2PR 5, PR 6
5Student 2VISP1/23/20232/3/20232/6/20233/3/20233/31/20234/28/20235/26/20236/23/20236/23/2023Student 3PR 2
6Student 3VISP4/17/20234/28/20235/1/20235/26/20236/23/20237/21/20238/18/20239/15/202310/13/2023Student 10Staffing ICP
7Student 4VISP3/6/20233/17/20233/20/20234/14/20235/12/20236/9/20237/7/20238/4/20239/1/2023Student 15Staffing ICP
8Student 5AT10/31/202211/11/202211/14/202212/9/20221/6/20232/3/20233/3/20233/31/20234/28/2023Student 18PR 1
9Student 6 AT7/11/20227/22/20227/25/20228/19/20229/16/202210/14/202211/11/202212/9/20221/6/2023
10Student 7AT4/4/20224/15/20224/18/20225/13/20226/10/20227/8/20228/5/20229/2/20229/30/2022
11Student 8VISP4/3/20234/14/20234/17/20235/12/20236/9/20237/7/20238/4/20239/1/20239/29/2023
12Student 9VISP6/2/20236/13/20236/16/20237/13/20238/10/20239/7/202310/5/202311/2/202312/7/2023
13Student 10VISP6/12/20236/23/20236/26/20237/21/20238/18/20239/15/202310/13/202311/10/202312/15/2023
14Student 11VISP8/8/20228/19/20228/22/20229/16/202210/14/202211/11/202212/9/20221/6/20232/3/2023
15Student 12VISP8/8/20228/19/20228/22/20229/16/202210/14/202211/11/202212/9/20221/6/20232/3/2023
16Student 13AT10/3/202210/14/202210/17/202211/11/202212/9/20221/6/20232/3/20233/3/20233/31/2023
17Student 14VISP1/9/20231/20/20231/23/20232/17/20233/17/20234/14/20235/12/20236/9/20237/7/2023
18Student 15VISP6/12/20236/23/20236/26/20237/21/20238/18/20239/15/202310/13/202311/10/202312/15/2023
19Student 16AT10/13/202210/24/202210/27/202211/23/202212/21/20221/18/20232/15/20233/15/20234/12/2023
20Student 17VISP10/17/202210/28/202210/31/202211/25/202212/23/20221/20/20232/17/20233/17/20234/14/2023
21Student 18VISP5/15/20235/26/20235/29/20236/23/20237/21/20238/18/20239/15/202310/13/202311/10/2023
22Student 19VISP4/3/20234/14/20234/17/20235/12/20236/9/20237/7/20238/4/20239/1/20239/29/2023
23Student 20VISP5/1/20235/12/20235/15/20236/9/20237/7/20238/4/20239/1/20239/29/202310/27/2023
24Student 21VISP5/30/20236/10/20236/13/20237/10/20238/7/20239/4/202310/2/202310/30/202312/4/2023
Sheet1
Cell Formulas
RangeFormula
M4:M8M4=FILTER(Table1[Student],BYROW((Table1[[Assessment Begins]:[PR 6]]-$M$2<=6)*(Table1[[Assessment Begins]:[PR 6]]-$M$2>=0),LAMBDA(x,SUM(x)))>0)
N4:N8N4=TEXTJOIN(", ",TRUE,FILTER(Table1[[#Headers],[Assessment Begins]:[PR 6]],FILTER((Table1[[Assessment Begins]:[PR 6]]-$M$2<=6)*(Table1[[Assessment Begins]:[PR 6]]-$M$2>=0),Table1[Student]=M4)=1))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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