Extract names from unstructured content


 

If you want to extract a name from a cell, you might think of using LEFT, RIGHT, MID. But this case is different: we need to search through many unstructured cells and return "John" if John is found, "Mary" if Mary is found. Do LEFT, RIGHT, MID still apply?

Extract names from unstructured content

=IF(ISNUMBER(FIND("John",B2)),"John",IF(ISNUMBER(FIND("Mary",B2)),"Mary","Others"))

C2:=IF(ISNUMBER(FIND(“John”,B2)),”John”,IF(ISNUMBER(FIND(“Mary”,B2)),”Mary”,”Others”))
  1. Start by explaining FIND: FIND("John",B2) searches B2 for "John"; if found it returns the position of "John" in B2 (e.g. 1 if "John" starts at the first character). Otherwise, FIND returns an Error.
  2. =ISNUMBER(FIND("John",B2)) checks whether FIND returns a number. If yes, TRUE; otherwise FALSE. So it verifies whether B2 contains "John".
  3. =IF(ISNUMBER(FIND("John",B2)),"John",...) means if B2 contains "John" return "John", otherwise use the same method to check for "Mary" (i.e., a nested IF).
So whether or not the cell content is structured, the FIND+ISNUMBER combination can still check if the target text is present in the cell.

Comprehensive Technical Support Solutions

We provide a range of technical support solutions to meet your needs.
Explore our core services:

man and woman wearing headphones while working in the office

Get on-demand assistance with Microsoft Excel, Word and PowerPoint. Send your question via WhatsApp, and we will help you resolve it promptly.

serious diverse students looking at laptop

Join our Online Learning Group Facebook page. Explore more than 200 tutorials and a comprehensive library of instructional videos at your own pace.

woman in yellow blazer doing a presentation

Build your team’s skills with tailored corporate training programmes. Our courses are designed around your organisation’s needs and equip employees with practical, up-to-date tools.