Defining a list to lookup, then matching a value

MrBurn5

New Member
Joined
Jul 4, 2016
Messages
48
You guys have improved my excel knowledge by leaps and bounds, but I need a little help! :) My wife brought me this question tonight and I feel like this would be a nested match formula but I'm failing to make it work.

For some reason "Forum Tools" isn't working nicely with Excel 2016 for Mac, so pardon the look of the attached tables.

In Sheet 1 column F, we're trying to see if the course a student took (Column C) is required for their major (Column B) depending on the lists in Sheet 2. So basically, identify which list we want to look up depending on their major, and then matching the course ID.

The formulas in F right now were just some things we were trying.

Any insight or ideas would be greatly appreciated.

[TABLE="class: head"]
<tbody>[TR]
[TH][/TH]
[TH]
A​
[/TH]
[TH]
B​
[/TH]
[TH]C[/TH]
[TH]
D​
[/TH]
[TH]
E​
[/TH]
[TH]
F​
[/TH]
[/TR]
[TR]
[TD]
1​
[/TD]
[TD]ID[/TD]
[TD]MAJOR[/TD]
[TD]COURSE[/TD]
[TD]GRADE[/TD]
[TD]CHRS[/TD]
[TD]REQUIRED[/TD]
[/TR]
[TR]
[TD]
2​
[/TD]
[TD]
544782​
[/TD]
[TD]PNC.CT[/TD]
[TD]MAT131[/TD]
[TD]A[/TD]
[TD]
4​
[/TD]
[TD]=IF(OR(C2=Sheet2!B2, C2=Sheet2!C2, C2=Sheet2!D2, C2=Sheet2!E2), "Program", "Non-Program")[/TD]
[/TR]
[TR]
[TD]
3​
[/TD]
[TD]
544782​
[/TD]
[TD]PNC.CT[/TD]
[TD]ENG101[/TD]
[TD]C[/TD]
[TD]
4​
[/TD]
[TD]=IF(OR(C3=Sheet2!B3, C3=Sheet2!C3, C3=Sheet2!D3, C3=Sheet2!E3), "Program", "Non-Program")[/TD]
[/TR]
[TR]
[TD]
4​
[/TD]
[TD]
544782​
[/TD]
[TD]PNC.CT[/TD]
[TD]PSY205[/TD]
[TD]A[/TD]
[TD]
3​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5​
[/TD]
[TD]
531877​
[/TD]
[TD]BSC.AAB[/TD]
[TD]BIO411[/TD]
[TD]B[/TD]
[TD]
3​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
6​
[/TD]
[TD]
531877​
[/TD]
[TD]BSC.AAB[/TD]
[TD]PSY511[/TD]
[TD]D[/TD]
[TD]
3​
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid"]
<tbody>[TR]
[TD]Sheet: Sheet1[/TD]
[/TR]
</tbody>[/TABLE]


Unknown 64 bit


[TABLE="class: head"]
<tbody>[TR]
[TH][/TH]
[TH]
A​
[/TH]
[TH]B[/TH]
[TH]
C​
[/TH]
[TH]
D​
[/TH]
[TH]
E​
[/TH]
[/TR]
[TR]
[TD]
1​
[/TD]
[TD]MAJOR[/TD]
[TD]PROGRAM COURSE 1[/TD]
[TD]PROGRAM COURSE 2[/TD]
[TD]PROGRAM COURSE 3[/TD]
[TD]PROGRAM COURSE 4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]PNC.CT[/TD]
[TD]ENG 101[/TD]
[TD]MAT131[/TD]
[TD]SOC105[/TD]
[TD]ADC208[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]BSC.AAB[/TD]
[TD]BIO411[/TD]
[TD]MAT209[/TD]
[TD]SOC105[/TD]
[TD]PSYC511[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid"]
<tbody>[TR]
[TD]Sheet: Sheet2[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi,

Based on the sample you provided, this will work, we'll more than likely need to Add more ranges to the formula as I'm sure there are more than just the 2 Majors to lookup.


Book1
ABCDEF
1IDMAJORCOURSEGRADECHRSREQUIRED
2544782PNC.CTMAT131A4Program
3544782PNC.CTENG101C4Non-Program
4544782PNC.CTPSY205A3Non-Program
5531877BSC.AABBIO411B3Program
6531877BSC.AABPSY511D3Non-Program
Sheet 1
Cell Formulas
RangeFormula
F2=IF(COUNTIF(CHOOSE(MATCH(B2,'Sheet 2'!A$2:A$3,0),'Sheet 2'!$2:$2,'Sheet 2'!$3:$3),C2),"Program","Non-Program")


F2 formula copied down.


Book1
ABCDE
1MAJORPROGRAM COURSE 1PROGRAM COURSE 2PROGRAM COURSE 3PROGRAM COURSE 4
2PNC.CTENG 101MAT131SOC105ADC208
3BSC.AABBIO411MAT209SOC105PSYC511
Sheet 2
 
Upvote 0
Before testing my formula, be sure to remove the Space within the sheet name (Sheet 2) in my formula to match yours, as you don't have a space (Sheet2) in yours.
 
Last edited:
Upvote 0
Wow, yea, that was actually easier than I thought - because I learned more new stuff. :D

I've never used CHOOSE before, and I've never seen a range defined like $2:$2

When we add in the other hundred or so majors, do we need to fix this part of the the formula: MATCH(B2,'Sheet 2'!A$2:A$3,0),'Sheet 2'!$2:$2,'Sheet 2'!$3:$3
Thusly: MATCH(B2,'Sheet 2'!A$2:A$100,0),'Sheet 2'!$2:$2,'Sheet 2'!$3:$3, 'sheet 2'!$4:$4, 'Sheet 2'!$5:$5, 'sheet 2'!$6:$6, .... and so forth?
 
Upvote 0
Yes, that's Exactly what you would do, if you run into problems, post back.

But if you have 100 or so Majors to add, the formula can get pretty lengthy, although the CHOOSE function can accommodate up to 254, if I think of another way, I'll post again.

Edit: the range $2:$2 is the Entire row 2, as I didn't know how many courses there are, that's what I used. You can replace it with something like C2:Z2, C3:Z3, etc.

2nd Edit: I noticed Sheet1 C6 is PSY511, whereas, Sheet2 E3 is PSYC511, so that's not a match, and the result is "Non-Program", might be a typo?
 
Last edited:
Upvote 0
You're welcome.

BTW, I meant B$2:Z$2, C$3:Z$3, etc. above.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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