Return a value after searching a list for any of the terms in another list?

adacause

New Member
Joined
Mar 9, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a table of student schedules that I need to search for any of a long list of different classes (Math 1, Math 2, etc.) in a named range (Math). If the search finds any of the courses from the named range in a student’s schedule it would return what period of the day the student has that class. Students' names are in column 1, while the next 6 columns are periods 1, 2, 3… Is there any easy way to search for these (Math 1, Math 2, Math 3, and another 12) in table like the one below and return the last column? What function or formula would I use to get the last column in the table below? I’ve tried just about everything I can think of. Thanks.

123456Math Period?
Student AMath 1ELASpanish 1PEWorld HistoryBiology1
Student BELAPESpanish 3US HistoryMath 3Chemistry5
Student CELATAWoodshopMath 2BiologyArt4
Student DMath 1Spanish 1PEBiologyELAWorld History1
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the MrExcel board!

Is this what you mean?

22 03 09.xlsm
ABCDEFGH
1123456Math Period?
2Student AMath 1ELASpanish 1PEWorld HistoryBiology1
3Student BELAPESpanish 3US HistoryMath 3Chemistry5
4Student CELATAWoodshopMath 2BiologyArt4
5Student DMath 1Spanish 1PEBiologyELAWorld History1
Classes
Cell Formulas
RangeFormula
H2:H5H2=MATCH("Math*",B2:G2,0)
 
Upvote 0
Welcome to the MrExcel board!

Is this what you mean?

22 03 09.xlsm
ABCDEFGH
1123456Math Period?
2Student AMath 1ELASpanish 1PEWorld HistoryBiology1
3Student BELAPESpanish 3US HistoryMath 3Chemistry5
4Student CELATAWoodshopMath 2BiologyArt4
5Student DMath 1Spanish 1PEBiologyELAWorld History1
Classes
Cell Formulas
RangeFormula
H2:H5H2=MATCH("Math*",B2:G2,0)
Thanks. Sort of. I can't use the wildcard because not all the course names have the term "math" - like "statistics" or "calculus". I have a named range called "Math" with all the course names in it (I don't know if that makes it easier or harder).

When I try the match function I get an array that spills down into the next row with "#N/A", and then eventually the correct period shows up In the list of "#N/A"s. Sorta like the list below, except longer. Thanks.

#N/A
#N/A
#/NA
6
#N/a
 
Upvote 0
Is it more like this then?

22 03 09.xlsm
ABCDEFGHIJ
1123456Language ClassLanguage
2Student AMath 1ELASpanish 1PEWorld HistoryBiology3Spanish 1
3Student BELAPESpanish 3US HistoryFrench 2Chemistry3, 5Spanish 2
4Student CELATAWoodshopMath 2BiologyFrench 26Spanish 3
5Student DMath 1Spanish 1PEBiologyELAWorld History2French 1
6French 2
7
Classes
Cell Formulas
RangeFormula
H2:H5H2=TEXTJOIN(", ",1,FILTER(B$1:G$1,ISNUMBER(MATCH(B2:G2,Language,0)),""))
Named Ranges
NameRefers ToCells
Language=Classes!$J$2:$J$6H2:H5
 
Upvote 0
Solution
Is it more like this then?

22 03 09.xlsm
ABCDEFGHIJ
1123456Language ClassLanguage
2Student AMath 1ELASpanish 1PEWorld HistoryBiology3Spanish 1
3Student BELAPESpanish 3US HistoryFrench 2Chemistry3, 5Spanish 2
4Student CELATAWoodshopMath 2BiologyFrench 26Spanish 3
5Student DMath 1Spanish 1PEBiologyELAWorld History2French 1
6French 2
7
Classes
Cell Formulas
RangeFormula
H2:H5H2=TEXTJOIN(", ",1,FILTER(B$1:G$1,ISNUMBER(MATCH(B2:G2,Language,0)),""))
Named Ranges
NameRefers ToCells
Language=Classes!$J$2:$J$6H2:H5
You sir are a wonderful human being. I spent hours trying to figure that out. I will have to study that for a bit and figure out what it means. Thank you.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

(For future questions, consider XL2BB for your sample data.)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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