简体   繁体   中英

Excel comparing two columns and creating a new column

Okay, this is a bit of a confusing question. I have a two column excel document. Column A contains sentences with names. Column B contains Full names (first and last)

Thanks!

I would copy over your column "B" to a new sheet to save it. I would then text to columns for the second column on spaces. I would put this new function in the sixth column

=IF(ISERROR(FIND(B1,A1))=TRUE,IF(ISERROR(FIND(C1,A1))=TRUE,IF(ISERROR(FIND(D1,A1))=TRUE,IF(ISERROR(FIND(F1,A1))=TRUE,"Name not found",FIND(F1,A1)),FIND(D1,A1)),FIND(C1,A1)),FIND(B1,A1))

Hopefully this will get you started in the right direction. Using your example, in cell C2 and copied down:

=IFERROR(INDEX($B$2:$B$4,MATCH(TRUE,INDEX(COUNTIF(A2,"*"&TRIM(LEFT(SUBSTITUTE($B$2:$B$4," ",REPT(" ",99)),99))&"*")>0,),0)),"No Matches")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM