how to I get Excel to automate this process?

DentonHTHS

New Member
Joined
Jul 3, 2008
Messages
39
Hi everyone, I have a sample file of the work I am trying to do with a much larger file. Basically, I would like the second tab to automatically pull the data from the first tab. On tab 2, I will have the column of student names but would like to have the number of courses they are failing and the name of the course(s) listed out on the same line. On the first tab, the number "1" indicates that the student is taking the course and is failing.

Any help would be greatly appreciated.

DentonHTHS
Tab 1
StudentCourse 1Course 2Course 3Course 4Course 5
Bruce Wayne111
Hal Jordan111
Barry Allen11
Diana Prince1
Clark Kent11

<tbody>
</tbody>

Tab 2
Student# Courses Failing12345
Bruce Wayne3Course 1Course 3Course 5
Hal Jordan3Course 1Course 3Course 4
Barry Allen2Course 3Course 5
Diana Prince1Course 2
Clark Kent2Course 1Course 3

<tbody>
</tbody>

I need formulas that will insert the names of the courses each student has failed in the spaces in Colums B-G and total the amount failed in Column B pulling the data from Tab 1
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
assuming the data on tab1 starts in column A you could try

Excel 2013
ABCDEFG
8StudentCourses Failing12345
9Bruce Wayne3Course 1Course 3Course 5
10Hal Jordan3Course 1Course 3Course 4
11Barry Allen2Course 3Course 5
12Diana Prince1Course 2
13Clark Kent2Course 1Course 3

<tbody>
</tbody>
tab 1

Worksheet Formulas
CellFormula
B9=SUMPRODUCT(('tab 1'!$A$2:$A$6=A9)*('tab 1'!$B$2:$F$6))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
C9{=IFERROR(INDEX('tab 1'!$B$1:$F$1,SMALL(IF(('tab 1'!$A$2:$A$6=$A9)*('tab 1'!$B$2:$F$6=1),COLUMN('tab 1'!$B$1:$F$1)-COLUMN('tab 1'!$B$1)+1),COLUMNS($C9:C9))),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
A similar, but slightly different version:

ABCDEF
1StudentCourse 1Course 2Course 3Course 4Course 5
2Bruce Wayne111
3Hal Jordan111
4Barry Allen11
5Kara Danvers
6Diana Prince1
7Clark Kent11

<tbody>
</tbody>
Sheet1



ABCDEFG
1Student# Courses Failing12345
2Bruce Wayne3Course 1Course 3Course 5
3Hal Jordan3Course 1Course 3Course 4
4Barry Allen2Course 3Course 5
5Diana Prince1Course 2
6Clark Kent2Course 1Course 3

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
B2=IF(A2="","",SUMPRODUCT((Sheet1!$A$2:$A$7=A2)*(Sheet1!$B$2:$F$7=1)))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
A2{=IF(A1="","",IFERROR(INDEX(Sheet1!A:A,SMALL(IF(SUBTOTAL(2,OFFSET(Sheet1!$A$1,ROW($A$2:$A$7)-ROW($A$2)+1,1,1,5))>0,ROW($A$2:$A$7)),ROWS($A$2:$A2))),""))}
C2{=IF(B2="","",IFERROR(INDEX(Sheet1!$B$1:$G$1,SMALL(IF(SUBTOTAL(2,OFFSET(Sheet1!$A$1,MATCH($A2,Sheet1!$A$2:$A$7,0),ROW($1:$5)))>0,ROW($1:$5)),COLUMNS($C2:C2))),""))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



The formula in A2 will list only those students with at least 1 failing class. Put in A2, confirm with Control+Shift+Enter and copy down. Put B2 in and copy down. Put in C2, confirm with Control+Shift+Enter and copy down and across. These formulas do assume that on the grid on Sheet1, the accepted values are 1 or empty. If there are other possible values, I'll need to adjust the formulas.

You might also want to consider a VBA solution, since that would be fairly simple to code.
 
Upvote 0
I have tried to apply this formula to my larger sheet but haven't had any luck making the changes. I either get a circular expression argument or that I can't change part of an array. The workbook I am using has 285 student names as the rows and the courses being taught as the columns (from A to BZ). If a student is failing the course there is a "1" in the cell under that course corresponding to the student, otherwise it is blank. Using the same parameters able how do I edit the formula to make it work for this larger workbook. I am missing something somewhere. :(
 
Last edited:
Upvote 0
Thank you! I got that to work. I am copying it down and making a note so I can do it properly the next time. :)
Much appreciated!
 
Upvote 0

Forum statistics

Threads
1,217,181
Messages
6,135,061
Members
449,909
Latest member
CCaff

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