Hi, everyone. Need some help with a stumper.
I'm trying to create a tool that splits the name and last name in a cell into three cells (one cell for the first name and the other two for both last names, as we have two last names in Spanish). The rest of the formula is already put together correctly. Here's the problem. It's gonna be a wild ride, so bear with me, please.
The main problem here is some last names in Spanish have prepositions next to them (such as "de la Torre" or "del Pino"). I tried to create a formula that either takes the last name OR it takes all the text at the right of the cell starting from the preposition. This is the formula that I wrote:
This formula works well if the full name is "Carlos Fernández de la Torre" (it returns "de la Torre"), but not if the name is "Jorge de la Torre Fernández" (it returns "de la Torre Fernández"). I need a formula that is able to return the last name (including "de la") ONLY if the word to the right of "de la" is the last word in the string of text. The desired result if C19 was "Jorge de la Torre Fernández" is "Fernández". However, if C19 was "Carlos Fernández de la Torre", the desired result would in turn be "de la Torre". I know the problem is a bit convoluted, but I appreciate all the help I get.
I'm trying to create a tool that splits the name and last name in a cell into three cells (one cell for the first name and the other two for both last names, as we have two last names in Spanish). The rest of the formula is already put together correctly. Here's the problem. It's gonna be a wild ride, so bear with me, please.
The main problem here is some last names in Spanish have prepositions next to them (such as "de la Torre" or "del Pino"). I tried to create a formula that either takes the last name OR it takes all the text at the right of the cell starting from the preposition. This is the formula that I wrote:
Excel Formula:
=IFERROR(RIGHT(C19;LEN(C19)-FIND(" de la ";C19));TEXTAFTER(C19;" ";-1))
This formula works well if the full name is "Carlos Fernández de la Torre" (it returns "de la Torre"), but not if the name is "Jorge de la Torre Fernández" (it returns "de la Torre Fernández"). I need a formula that is able to return the last name (including "de la") ONLY if the word to the right of "de la" is the last word in the string of text. The desired result if C19 was "Jorge de la Torre Fernández" is "Fernández". However, if C19 was "Carlos Fernández de la Torre", the desired result would in turn be "de la Torre". I know the problem is a bit convoluted, but I appreciate all the help I get.