Saturday, July 8, 2017

yogi_In Reference To Column A Provide Clean Names In Column C Considering Roster Names In Column I

Google Spreadsheet   Post  #2204
Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     www.energyefficientbuild.com.   Jul-08-2017
question by Sam Larimer:
https://productforums.google.com/forum/?utm_medium=email&utm_source=best_answer_notification_button#!topic/docs/nTDJouyOSfY;context-place=forum/docs

CONDITIONALS: Replace out-of-order/cluttered names with clean names from given roster


An exported report gives names that contain extra characters, names out of order, or both. I need the names to be replaced in correct First Name Last Name order.

Document in question: Names in order

If column A contains strings of names and column I contains a cleaned up roster, reorganize and remove non-letter characters. Return "clean" name in column C.

The spreadsheet contains a goal return (column E) and match check (column F)

So far, I've only been able to reorganize names if they are in the form BBBB AAAA with only one space. The following issues still exist:
  • Names that contain extra characters (1 or 2 plus signs) at the end of the last name field. "B++ A" should be "A B++"
  • Names that contain multiple words in surname are reorganized from "B C A" to "C A B", but they should be "A B C"
  • Optional: Names that are reported as "LastName, FirstName" reorganize as "FirstName LastName"...basically, I don't need something that only ignores plus signs. It should ignore any extra characters.

Now for the challenge. Avoid Google Script. I am extremely amateur at this stuff still and cannot code to save my life. This formula will need to be used and replicated in the future by other users in various applications.

Here's what I have currently. Feel free to scrap and start from scratch if it's as ugly as I think it is.

=IF(ISBLANK(A2),
A2,
IF(ISERROR(MATCH(A2,I:I,0)),
IF(ISERROR(MATCH(MID(A2&" "&A2,FIND(" ",A2)+1,LEN(A2)),I:I,0)),
A2,
MID(A2&" "&A2,FIND(" ",A2)+1,LEN(A2))),
A2))