Partial Match In Cell Returns Particular Value

mdsurf

New Member
Joined
Aug 1, 2017
Messages
22
Office Version
  1. 2016
Platform
  1. MacOS
Hi there! I have a list of names and companies that I am trying to match against another list and have it return specific values. I'm completely and utterly lost at how to even start thinking about this so wondering if someone can help out.

Tab 1:
NameCompany
John SmithCompany A
Jane DoeCompany B
Ryan ReynoldsCompany C
Leonardo DicaprioCompany D
Will SmithCompany E

The next batch of info I have is a sentence which contains the names of the people. I would like to search these sentences, find the name and return the company value if possible.

SentenceEquation which searches the sentence against the list of names and returns Company Name
John Smith is a great guyCompany A
Have you heard from Jane Doe recentlyCompany B
Tomorrow is Will Smith birthdayCompany E

Is this even possible to do? I am using Microsoft Excel for Mac version 16.16.27

Thank you!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi MDSurf,

Does this do what you want?

MDSurf2.xlsx
AB
1NameCompany
2John SmithCompany A
3Jane DoeCompany B
4Ryan ReynoldsCompany C
5Leonardo DicaprioCompany D
6Will SmithCompany E
7
Tab1


MDSurf2.xlsx
ABC
1SentenceResult
2John Smith is a great guyCompany ACompany A
3Have you heard from Jane Doe recentlyCompany BCompany B
4Tomorrow is Will Smith birthdayCompany ECompany E
5Popeye eats spinachNo match
6No match
Tab2
Cell Formulas
RangeFormula
C2:C6C2=IFERROR(INDEX('Tab1'!$B$2:$B$17,AGGREGATE(15,6,ROW('Tab1'!$A$2:$A$17)-ROW('Tab1'!$A$1)/(MATCH("*"&'Tab1'!$A$2:$A$17&"*",A2,0)*('Tab1'!$A$2:$A$17<>"")),1)),"No match")
 
Upvote 0
Hey! thank you for the detailed reply and that crazy long formula. Unfortunately it didn't work but I think it's close. I think I messed up my explanation / example a little bit unfortunately.

In my example, for tab 2 column B that column is actually blank and where I plan to put the formula. I just put the Company A, Company B etc on what the expected result should be, but in my excel this column is blank.

Also, not sure if it matters but there are ALOT of rows in my sheet so there will be multiple matches for 'John Smith' appears in multiple rows, but different sentences.

Thank you so much for the help!
 
Upvote 0
I am using Microsoft Excel for Mac version 16.16.27
Please update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

1634788170659.png


I think that you may need a bit more rigorous formula otherwise you might get some false matches with data like in F6:F7 of my sample data - see col H.
This is my suggestion.
(Not sure about your version on a Mac but if it is not returning correct results, try confirming it with Ctrl+Shift+Enter, not just Enter.
Also, I have put this on one sheet but it should work just as well over two. Post back if you want help to convert it.

BTW, would it ever be possible that two or more names match in one sentence? If so, what do you need to happen? You will see that the two suggestions so far return just one of the relevant companies.

21 10 21.xlsm
ABCDEFGH
1NameCompanySentenceResultPost #2 equiv formula
2John SmithCompany AJohn Smith is a great guyCompany ACompany A
3Jane DoeCompany BHave you heard from Jane Doe recentlyCompany BCompany B
4Ryan ReynoldsCompany CTomorrow is Will Smith birthdayCompany ECompany E
5Leonardo DicaprioCompany DPopeye eats spinachNo matchNo match
6Will SmithCompany EJohn Smithworth is a great guyNo matchCompany A
7Sara-Jane DoertyNo matchCompany B
8John Smith and Jane Doe were thereCompany BCompany A
Company lookup
Cell Formulas
RangeFormula
G2:G8G2=IFNA(LOOKUP(9^9,SEARCH(" "&A$2:A$6&" "," "&F2&" "),B$2:B$6),"No match")
H2:H8H2=IFERROR(INDEX($B$2:$B$17,AGGREGATE(15,6,ROW($A$2:$A$17)-ROW($A$1)/(MATCH("*"&$A$2:$A$17&"*",F2,0)*($A$2:$A$17<>"")),1)),"No match")
 
Upvote 0
Also, not sure if it matters but there are ALOT of rows in my sheet so there will be multiple matches for 'John Smith' appears in multiple rows, but different sentences.

Thank you so much for the help!
MDSurf,

Yes, I forgot to remove your reference column.

I see @Peter_SSs has provided a shorter formula.

MDSurf2.xlsx
AB
1SentenceResult
2John Smith is a great guyCompany A
3Have you heard from Jane Doe recentlyCompany B
4Tomorrow is Will Smith birthdayCompany E
5Popeye eats spinachNo match
6Will John Smith appear twice?Company A
7Will Smith appear twice?Company E
8Don't annoy Will SmithCompany E
9YesThisMatchesJohn Smithalso.Company A
10There is no John Smithers on the listCompany A
11No match
Tab2
Cell Formulas
RangeFormula
B2:B11B2=IFERROR(INDEX('Tab1'!$B$2:$B$9999,AGGREGATE(15,6,ROW('Tab1'!$A$2:$A$9999)-ROW('Tab1'!$A$1)/(MATCH("*"&'Tab1'!$A$2:$A$9999&"*",A2,0)*('Tab1'!$A$2:$A$9999<>"")),1)),"No match")
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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