Determine whether an alpha value falls within a range...

merlinCLT

New Member
Joined
Mar 3, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Greetings, All,

I am using two spreadsheets consisting of the following fields:

1) High school students' school name, first and last names
2) Counselor names and caseload alphabetical ranges

I am trying to create a formula to populate the school counselor's name for each respective student based on the assigned alpha named range for each counselor. Ultimately, I want to be able to mail merge student data with emails to school counselors for their reference.

The actual list I have includes 1000+ records and rather than manually enter the assigned counselor in each cell, I am hoping that someone may have an idea of how to create a function or VBA that would make this process more streamlined.

Student Data

Student_FirstStudent_LastHigh_SchoolAssigned_Counselor
AdamBrownAKHS
JessicaBrownBHS
TommyLeeVHS
AzizAnsariAKHS
MichaelScottVHS
HowiePiersonBHS
LilaThurmondTHS

Counselor Data

Counselor_FirstCounselor_LastHigh_SchoolCaseload
KellyThompsonAKHSA-Moon
MaryBlackBHSA-Kit
GaryBuseyBHSKita-Z
BudShiffmanAKHSMoona-Z
ScottWilliamsTHSAll Students
SusieQuintanoVHSAll Students

Desired Outcome

Student_FirstStudent_LastHigh SchoolAssigned_Counselor
AdamBrownAKHSThompson
JessicaBrownBHSBlack
TommyLeeVHSQuintano
AzizAnsariAKHSThompson
MichaelScottVHSQuintano
HowiePiersonBHSBusey
LilaThurmondTHSThurmond

Thanks, in advance, for any thoughts!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Welcome to the MrExcel board!

Would you be open to altering the Counsellor table a little as shown below?
If so, I have provided 2 options. They are basically the same but IF you have the LET function the second one is a little shorter to write. :)
I have assumed that the last cell in your shown desired outcome is a mistake.

merlinCLT.xlsm
ABCDE
1Student_FirstStudent_LastHigh_SchoolAssigned_Counselor
2AdamBrownAKHSThompsonThompson
3JessicaBrownBHSBlackBlack
4TommyLeeVHSQuintanoQuintano
5AzizAnsariAKHSThompsonThompson
6MichaelScottVHSQuintanoQuintano
7HowiePiersonBHSBuseyBusey
8LilaThurmondTHSWilliamsWilliams
9
10Counselor_FirstCounselor_LastHigh_SchoolCaseload
11KellyThompsonAKHSA-Moon
12MaryBlackBHSA-Kit
13GaryBuseyBHSKita-ZZ
14BudShiffmanAKHSMoona-ZZ
15ScottWilliamsTHSA-ZZ
16SusieQuintanoVHSA-ZZ
Sheet1
Cell Formulas
RangeFormula
D2:D8D2=FILTER(B$11:B$16,(C$11:C$16=C2)*(B2>=LEFT(D$11:D$16,FIND("-",D$11:D$16)-1))*(B2<=REPLACE(D$11:D$16,1,FIND("-",D$11:D$16),"")),"?")
E2:E8E2=LET(D,D$11:D$16,FILTER(B$11:B$16,(C$11:C$16=C2)*(B2>=LEFT(D,FIND("-",D)-1))*(B2<=REPLACE(D,1,FIND("-",D),"")),"?"))
 
Upvote 0
Peter,

Thanks for the quick response. It appears that your recommendation should work; however, I do not yet have access to the Let and Filter functions as my Excel account is managed as an enterprise account. I have reached out to our IT team to see whether it is possible to update in order to have access to the functions. In the meantime, I would welcome any additional suggestions for you or the community.

Thanks, again,

Andrew
 
Upvote 0
How about
Excel Formula:
=INDEX($B$11:$B$16,AGGREGATE(15,6,(ROW($B$11:$B$16)-ROW($B$11)+1)/($C$11:$C$16=C2)/(B2>=LEFT($D$11:$D$16,FIND("-",$D$11:$D$16)-1))/(B2<=REPLACE(D$11:D$16,1,FIND("-",D$11:D$16),"")),1))
 
Upvote 0
This works on your example, and I believe it should work overall, although you'd want to test it more. It requires that you sort the Counselor table by high school, then by caseload.

Book1
ABCD
1Student_FirstStudent_LastHigh_SchoolAssigned_Counselor
2AdamBrownAKHSThompson
3JessicaBrownBHSBlack
4TommyLeeVHSQuintano
5AzizAnsariAKHSThompson
6MichaelScottVHSQuintano
7HowiePiersonBHSBusey
8LilaThurmondTHSWilliams
9
10Counselor Data
11
12Counselor_FirstCounselor_LastHigh_SchoolCaseload
13KellyThompsonAKHSA-Moon
14BudShiffmanAKHSMoona-Z
15MaryBlackBHSA-Kit
16GaryBuseyBHSKita-Z
17ScottWilliamsTHSA-ZZ
18SusieQuintanoVHSA-ZZ
Sheet10
Cell Formulas
RangeFormula
D2:D8D2=INDEX($B$13:$B$18,MATCH(C2&"|"&B2,$C$13:$C$18&"|"&LEFT($D$13:$D$18,FIND("-",$D$13:$D$18)-1)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
All,

Thank you for your contributions toward this inquiry! I was able to return the results to my question using both @Fluff and @Eric W recommended formulas. I was hoping that these formulas would enable me to accurately match students with their counselors; however, there is an additional component that I did not consider: Grade_level. Some counselors are assigned to a range of last names for specific grade levels, while others may be responsible for an entire grade level. This adds a layer of complexity that I am not certain how to address. I hold the same goal as originally expressed (to match the counselor to the student); however, I need to match the counselor based on the student last name and grade to the appropriate counselor assigned for that grade and name range. I can manipulate the data in anyway that will make it more feasible (i.e. I could partition out names or concatenate ranges, etc.).

The dataset I am using can be accessed here:

Please let me know if you have any recommendations for this additional layer of complexity.

Thanks to all!
 
Last edited by a moderator:
Upvote 0
I have removed the link to your file as it looks to contain genuine names & email address.
Can you please supply another version with fake details. Thanks
Also on rows 19 & 20 you have 2 counsellors for that school one with an X for grade 10 & one for grade 11.
Does the X signify that counsellor handles the entire grade? If so who handles grades 9 & 12?
 
Upvote 0
If you change the G1:J1 headers as shown
Match Student with Counselor.xlsx
ABCDEFGHIJK
1SCHOOLCOUNSELOR FIRST NAMECOUNSELOR LAST NAMEEMAILBEGINNING ALPHAEND ALPHA9101112GRADE ALL
2302 - Ardrey KellHYZZBFYPCAUCLUHYZZB.FYPCAUCLU@abc.xyzABROOKSX
3302 - Ardrey KellZUKLFLRLYKCUZUKL.FLRLYKCU@abc.xyzBROWNDERX
4302 - Ardrey KellHKLOALZBCKPSUOHKLOALZBC.KPSUO@abc.xyzDESGONZALEZX
5302 - Ardrey KellSPKBOPKAGYZZSPKB.OPKAGYZZ@abc.xyzGOODJORX
6302 - Ardrey KellVEPOLABMKUUHOVEPOLAB.MKUUHO@abc.xyzJOSMARX
7302 - Ardrey KellVEPFVPMZYVEPF.VPMZY@abc.xyzMASPATELX
8302 - Ardrey KellEYPAEYKOVELXXSPCEYPAEYK.OVELXXSPC@abc.xyzPATHSABX
9302 - Ardrey KellSPKLPSVVUWKASPKLP.SVVUWKA@abc.xyzSACTHOMASX
10302 - Ardrey KellZPOPCFKPKUMLCOUCZPOPCFKP.KUMLCOUC@abc.xyzTHOMPSONZZX
11312 - HoughQPNPWJECOWMYKQPNPWJEC.OWMYK@abc.xyzACAX
12312 - HoughFPLCPGUWZZPKFFPLCP.GUWZZPKF@abc.xyzCBFEX
13312 - HoughFPCPVPAVERUZYFPCP.VPAVERUZY@abc.xyzFGHX
14312 - HoughVPZZLYOSLAEVPZZLY.OSLAE@abc.xyzIMAX
15312 - HoughPZLOUCJKPNYOPZLOUC.JKPNYO@abc.xyzMBPEX
16312 - HoughSLVEPYZVUMMSLVEPYZ.VUMM@abc.xyzPFSMX
17312 - HoughSPJEYCKWMMLCUSPJEYC.KWMMLCU@abc.xyzSNZZX
18334 - CatoHYLAEOSLAEHYLAE.OSLAE@abc.xyzAZZX
19341 - Cochrane Collegiate AcademyFUCAÉEPKKLOFUCAÉ.EPKKLO@abc.xyzAZZX
20341 - Cochrane Collegiate AcademyHYBPFWCCHYBP.FWCC@abc.xyzAZZX
21361 - ButlerVUKACYBEYCFYKOUCVUKACYB.EYCFYKOUC@abc.xyzAZZX
22361 - ButlerYZZYCSYCCLAAYZZYC.SYCCLAA@abc.xyzALX
23361 - ButlerQPCCYZZYYCJZLOEQPCCYZZY.YCJZLOE@abc.xyzALX
24361 - ButlerZYOMKUUHOZYO.MKUUHO@abc.xyzAZZX
25361 - ButlerSYZUFBVPKKSYZUFB.VPKK@abc.xyzMZZX
26361 - ButlerNPZYCALCPUKAYJPNPZYCALCP.UKAYJP@abc.xyzMZZX
27377 - East MeckQUCPAEPCGLZZLPSOQUCPAEPC.GLZZLPSO@abc.xyzAEIXXX
Counselors


Match Student with Counselor.xlsx
ABCDEF
1Student_ID#Student_First_NameStudent_Last_NameHigh_SchoolGradeCounselor_Email
222151574MaxBlackmore302 - Ardrey Kell9HYZZB.FYPCAUCLU@abc.xyz
371844409ManveerHensley302 - Ardrey Kell9SPKB.OPKAGYZZ@abc.xyz
420601795KierenLivingston302 - Ardrey Kell9VEPOLAB.MKUUHO@abc.xyz
526801857KacyPalacios302 - Ardrey Kell9VEPF.VPMZY@abc.xyz
634235789JaydnBowes302 - Ardrey Kell10HYZZB.FYPCAUCLU@abc.xyz
772332711MarniChavez302 - Ardrey Kell10ZUKL.FLRLYKCU@abc.xyz
828380377AmaniEdmonds302 - Ardrey Kell10HKLOALZBC.KPSUO@abc.xyz
938567646EvelynHenson302 - Ardrey Kell10SPKB.OPKAGYZZ@abc.xyz
13717510804MarshaMacdonald334 - Cato12HYLAE.OSLAE@abc.xyz
13858147960DaleReeves341 - Cochrane Collegiate Academy9#NUM!
13912693285AdenBains341 - Cochrane Collegiate Academy10HYBP.FWCC@abc.xyz
14034406229BradleyBroadhurst341 - Cochrane Collegiate Academy10HYBP.FWCC@abc.xyz
14191233759EllieCarpenter341 - Cochrane Collegiate Academy10HYBP.FWCC@abc.xyz
14261275464AlyssaMolloy341 - Cochrane Collegiate Academy10HYBP.FWCC@abc.xyz
14372457337Alfie-LeeWalmsley341 - Cochrane Collegiate Academy10HYBP.FWCC@abc.xyz
14418911914MiltonDelgado341 - Cochrane Collegiate Academy11FUCAÉ.EPKKLO@abc.xyz
14552547398FoxHayes341 - Cochrane Collegiate Academy11FUCAÉ.EPKKLO@abc.xyz
15529660705AleksandraZuniga341 - Cochrane Collegiate Academy11FUCAÉ.EPKKLO@abc.xyz
1566898147IshmaelBurch341 - Cochrane Collegiate Academy12#NUM!
Students
Cell Formulas
RangeFormula
F2:F9,F137:F145,F155:F156F2=INDEX(Counselors!$D$2:$D$138,AGGREGATE(15,6,(ROW(Counselors!$D$2:$D$138)-ROW(Counselors!$D$2)+1)/(Counselors!$A$2:$A$138=D2)/IF(Counselors!$K$2:$K$138="X",(C2>=Counselors!$E$2:$E$138)/(C2<=Counselors!$F$2:$F$138&"Z"),(Counselors!$G$1:$I$1=E2)/(Counselors!$G$2:$I$138="X")),1))
 
Upvote 0
Fluff,

Thanks for the clarification. The document (Match Student with Counselor) now only reflect fictitious data.

I cleaned rows 19&20 so each grade would be represented. As you can see in the data, there exists much variability between school counselor caseload assignments across schools. The 'X' indicates that that counselor handles that grade for the name range expressed in columns E&F on the Counselors worksheet.

Let me know if any additional clarification is needed.

Thanks,

Andrew
 
Upvote 0
Thanks for that,, a slight change to the formula in post#8 it should be
Excel Formula:
=INDEX(Counselors!$D$2:$D$138,AGGREGATE(15,6,(ROW(Counselors!$D$2:$D$138)-ROW(Counselors!$D$2)+1)/(Counselors!$A$2:$A$138=D2)/IF(Counselors!$K$2:$K$138="X",(C2>=Counselors!$E$2:$E$138)/(C2<=Counselors!$F$2:$F$138&"Z"),(Counselors!$G$1:$J$1=E2)/(Counselors!$G$2:$J$138="X")),1))
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,806
Members
449,337
Latest member
BBV123

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