Suppose I have a list of people with unique first and last names, in two columns, B and C. See example spreadsheet here.

Cell E6 contains the following text:

Firstname1 would like to say hello to Firstname2. Firstname3 also says hello.

I would like to write an in-cell formula (i.e., not using custom functions) that goes through the text and replaces first names with the corresponding last names. The result should look like this:

Lastname1 would like to say hello to Lastname2. Lastname3 also says hello.

I tried the following, but it seems not to work:


Any ideas? It's important that the solution not use a custom formula.

2 Answers 2


Yes you need additoinally add a regexextract step:

=regexreplace(A1,"(Firstname[0-9])",VLOOKUP(regexextract( A1,"Firstname[0-9]"),B:C,2,false))

enter image description here

  • SPLIT E6 by space to give a array
  • VLOOKUP the corresponding words in B:C
  • IF #N/A, Use the SPLITted array
  • JOIN back the modified array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.