Howdy folks. Almost the end of August here. Let’s wrap it up with a nice little partial text match in Excel challenge, inspired from my recent consulting gig. Say you are looking at few job titles that look similar and want to match them to correct title. Like below:
The assumptions are,
- Extra words or characters will be always at end
- The job list may not be in alphabetical order
How would you match? Obviously VLOOKUP won’t cut it. I know over the week Microsoft released XLOOKUP to the beta testers out in wild, but that probably won’t cut it either. So what next? How would you solve this problem?
Well, that is your homework.
To participate, simply download job title matching problem worksheet and use either formulas, Power Query or VBA to match the jobs. Post your solution formulas, M scripts, macros or haiku in the comments.
Can’t solve or won’t bother? Here is the solution…
Oh well, I guess your job titles are far cleaner than what I am used to. If you are just impatient, the download problem file has hidden worksheet with formula solution and Power Query connection.
I made a video explaining the partial text match Excel problem, my solutions (both formula and PQ). Check it out below or on my YouTube Channel.
Bored at work or home, need a challenge? Solve these Excel problems…
Solving hard problems is a good way to learn new things. So if you are up for a challenge, check out below Homework problems.
- How many calls we got out outside office hours?
- How many people used up their sick leave allotment?
- When is next Monday?
- Find-out if a number has repetitive digits?
- More Excel Homework problems, challenges & Easter Egg hunts
Good luck and don’t forget to post your answers in comments.
12 Responses to “Job Title Matching Problem [Excel Homework]”
Hi.
not sure if this is the right answer but I made it this way : VLOOKUP(LEFT('Job title cell',LEN('Matching job cell')),'matching job range',1,FALSE) and it worked.
I made a list of the desired options, stored it in I3:I8, then did a simple VLookup like this:
=VLOOKUP(LEFT([@[Job title]],10)&"*",$I$3:$I$8,1,FALSE)
I made a list of Job Titles I was looking for in the range G4:G9 then did a lookup with this formula:
=LOOKUP(2^15,SEARCH(G$4:G$9,B4),G$4:G$9)
I'm a simple man. I deal with Lookups (INDEX/MATCH) using job titles from Project Controls vs HR, and have to normalize the titles. Something like this example allows me to make categories:
=IFERROR(IFERROR(IFERROR(LEFT([@[Job title]], FIND(" -",[@[Job title]])-1), LEFT([@[Job title]], FIND(" (",[@[Job title]])-1)),LEFT([@[Job title]], FIND(" /",[@[Job title]])-1)),[@[Job title]])
Hi Chandoo,
Thanks for sharing an interesting task.
I have both a formula approach and a power-query approach.
Power Query Approach:
let
Source = Excel.CurrentWorkbook(){[Name="jobs"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Job title", type text}, {"Matching Job (correct answer)", type text}, {"Your formula", type text}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Job title", "Job title - Copy"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Job title", Splitter.SplitTextByAnyDelimiter({"-","/","("}, QuoteStyle.Csv), {"Job title.1", "Job title.2"}),
#"Trimmed Text" = Table.TransformColumns(#"Split Column by Delimiter",{{"Job title.1", Text.Trim, type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Trimmed Text",{{"Job title.1", "Matching Job Title"}, {"Job title - Copy", "Job title"}}),
#"Removed Other Columns" = Table.SelectColumns(#"Renamed Columns",{"Job title", "Matching Job Title"})
in
#"Removed Other Columns"
By the way the jobs-sq-solution you provided may not work properly if the job titles are randomly located in Column B but not in the fashion of ABC, ABC -1, ABC /2, ABC (3) etc. So you probably want to add a step to sort the first column before expanding the source.
Formula Approach:
In Cell D4 enter the following array formula and drag it down.
{=IFERROR(LEFT(B4,AGGREGATE(15,7,MATCH(ROW($40:$48),CODE(MID(B4,ROW(INDIRECT("1:"&LEN(B4))),1)),0),1)-2),B4)}
Both my solutions are based on the assumption that the additional job descriptions are followed by specific symbols in the text string. If there are more than 50k lines of data with more than 50 different symbols used in the text string, then my solution will fail or will need more work around. Yours is pretty efficient 🙂
My non-array formula is:
=IFERROR(LOOKUP(2,
1/(ISNUMBER(FIND([Job title],[@[Job title]]))*
([Job title][@[Job title]])),
[Job title]),[@[Job title]])
Hello, another option coud be:
D3=IF(COUNT(1/ISERR(SEARCH({"-","(","/"},B3)))=3,B3,D2)
Regards.
hi, my choice is:
=IF(ISNUMBER(SEARCH([@[Matching Job (correct answer)]];[@[Job title]]))=TRUE;[@[Matching Job (correct answer)]];"")
BR,
M.
I simply made a Text Formula:
=MID(jobs[[#CELL],[Job title]],1,LEN(jobs[[#CELL],[Matching Job (correct answer)]]))
I hope my translation from spanish to english is OK but this Works on my woorkbook.
Regards,
Hi ,
This seems to work :
=LEFT([@[Job title]],SMALL(IFERROR(IF(1,FIND([Job title],[@[Job title]])) * LEN([Job title]),999),1))
entered as an array formula , with CTRL SHIFT ENTER.
Hi,
{=COUNT(FIND($B$4:$B$19,$B4))}
Put a filter on 1 and that's your matching job.
=IF(ISERR(SEARCH("Procurement A",B4)), IF(ISERR(SEARCH("Project M",B4)), IF(ISERR(SEARCH("Project O",B4)), IF(ISERR(SEARCH("Admin",B4)), IF(ISERR(SEARCH("Pers",B4)), IF(ISERR(SEARCH("General",B4)), "No Matching Job","General Manager"),"Personal Assistant"),"Administrator"),"Project Office Analyst"),"Project Manager"),"Procurement Analyst")
Room for efficiency but the formula at least covers eventuality that there is no matching job titles 🙂