Is there a way to flip four namest? - google-sheets

I'm trying to put the last name and "," ahead of the first name and succeeding names.
I've managed to get it up to 3 names but now I have to account if the person has 4 names in their whole name. Mainly using this for Google Sheets.
Here's what I use for the 3 names.
=MID(TRIM(A2)&", "&TRIM(A2),IF(LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))=1,FIND(" ",TRIM(A2))+1,FIND(" ",TRIM(A2),FIND(" ",TRIM(A2))+1)+1),LEN(TRIM(A2))+1)
so that turns "John Doe Smith" into "Smith, John Doe"
Anyone can help to account for 4 names?

Use regexreplace(), like this:
=regexreplace(A2, "(.*) (\w+)", "$2, $1")
To learn the exact regular expression syntax used by Google Sheets, see RE2.

Use
=REGEXREPLACE(A2,"(\w+ \w+) (\w+)","$2, $1")

=REGEXREPLACE(A2,"(.*)\s(.*?)$","$2, $1")

Related

How to sort email addresses from google forms to one unique email?

Today I created a google form that saves automatic results to google sheets.
The idea is that I send e-mail correspondence, but sometimes there are jokers who enter a different age, name, but the same e-mail. I would like to sort this from the results obtained into another sheet called "sort", people who are over 23 years of age.
I created the formula:
=UNIQUE(QUERY(ask!A:D;"Select * Where D>=23"))
And it working correct.
Now how to add options to the formula already created above, so that it shows only one email address so that they do not duplicate each other? (Regardless of the name or age column ...)
I would like it to look like this in its final form:
Please help :)
perhaps try:
=UNIQUE(Ask!B2:C)
or try:
=SORTN(Ask!A2:D, 9^9, 2, 2, 0)

Substitute in Google Sheet but Ignore Particular string

I am using this formula in Google Sheets to substitute some string of words.
=ArrayFormula(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Z2:Z36000,"# ", "OF ")," ALUMINUM BAG ", ""),"BOX IN",""),"BOX OF",""),"",""))
The data
DATA Column Expected Results
BOX OF BEER BEER
BOX IN BASEMENT BASEMENT
BOX OF GIFT BOX OF GIFT
I would like to exclude "BOX OF GIFT" with Substitute. Can i do that? OR any other solutions?
You could use in B2:
=REGEXREPLACE(A2,"^(?:(BOX OF GIFT$)|BOX (?:OF|IN) )(.*)","$1$2")
Or:
=IF(A2="BOX OF GIFT",A2;REGEXREPLACE(A2,"\bBOX (?:OF|IN)\b *",""))
I'll see if I can come up with a cleaner option...

EXCEL VLOOKUP/MATCH/VARIABLE

Good Evening and thanks in advance for taking the time to read and help.
I have a 3 column excel file which I am trying to populate the 3rd column with a return value found next to the row its found in.
so for example I want to look at column MANAGERSFULLNAME for value
Cheryl Rommelfanger and find the match in column FULLNAME. Once the match is found I want to populate MANAGERSX2FULLNAME but not with the value found in FULLNAME but with the value next to in column MANAGERSFULLNAME
So for this example we look in MANAGERSFULLNAME for Cheryl Rommelfanger and find the match in FULLNAME Cheryl Rommelfanger then populate MANAGERSX2FULLNAME with
William Dearth
FULLNAME MANAGERSFULLNAME MANAGERSX2FULLNAME
Dena Peters Cheryl Rommelfanger
Kyle Marsh Melissa Hall
Cheryl Rommelfanger William Dearth
ive tried a few things and can only get a count not the value next to it.
=MATCH($E2&$F2,INDEX($B2:B4000&$C2:C4000,),)
=IF(ISERROR(MATCH(E2,F2,$B$2:B$4000,$C$2:C$4000,0)),"",E2)
=IF(ISERROR(MATCH(L2,$K$2:K$4000,0)),"",L20)
any help would be greatly appreciated.
So I apologize but I am having a bit of trouble understanding your columns, but the general idea is clear.
Your attempts are really close. You want to use index(match) as opposed to match(index). The link below describes how to do this.
Index match formula
If I'm understanding you correctly it sounds like you're trying to find and list the bosses boss so-to-speak to display a hierarchy of sorts. I'm using just columns A, B, and C (C being the managerx2fullname) this formula should work fine:
=index(B$2:B$4000,match(B2,A$2:A$4000,0))
You will of course need to change the columns to fit your needs. Don't include a dollar sign in B2 because you want this to increment as you drag the formula down the column. The link below shows a screen shot from my test. In it we see that in row 2 John is Adams boss, who in turn is Joe's boss. I think that's what you're shooting for here.
Screen shot

Google Sheets: "Bob Smith" --> "bsmith" formula?

I'm trying to pull data from another Google Sheet to feed another Google Sheet. I need to pull from a full name field, which will have something like, "Bob Smith" and then I need to have it rewrite into the new Google Sheet as "bsmith".
Basically, "Get first letter of the first string, then concatenate the entire second string, and then make all lowercase."
So far I've gotten =LEFT(A28,1) working to grab the first letter of a string, but then not sure how to grab the second word and then concatenate.
To get the 2nd word you need to FIND() the first space then read from that position + 1 to the end of the string using MID(). & is used for concatenation.
=lower(left(A28,1) & mid(A28, find(" ", A28) + 1, len(A28)))
Try this for a Google sheet specific solution:
=LOWER(REGEXREPLACE(A2,"^(\w).*?(\w+$)","$1$2"))
It uses REGEX, a much more sophisticated engine and easily adaptable to variations than LEFT and/or MID.
Shorter:
=lower(left(A28)&index(split(A28," "),2))
(Assumes only ever two words.)

Compare two lists, then add missing data to the bottom of one list?

I have been searching and searching and I've tried a dozen different things, and the array formula that added 50,000 rows to my sheet (I didn't even know that was possible...) and crashed my browser was the final straw. So I'm asking for help...
Basically, I have a static list of names in sheet1(Grades) that are sorted alphabetically. I have an importrange in sheet2(Data) with another list of names, not sorted alphabetically (And it cannot be sorted alphabetically.) Something like this:
Grades:
Bill
Charlie
Fred
George
Percy
Ron
and
Data:
Ron
Bill
Fred
Percy
Harry
Hermione
Molly
Arthur
What I need is to imput a formula in the cell below the last name on sheet1(Grades) that checks all of the names above that cell, compares them to the names on sheet2(Data), and returns the first name that's missing. For example:
Grades:
Bill
Charlie
Fred
George
Percy
Ron
(Formula Here) = Harry
(Formula Here) = Hermione
Etc.
The New names should always be at the bottom of the Data list, if that help any.
Here's a link to a copy of the spreadsheet.
Hope I got the permissions correct... Most of it was protected, but I think it should be open for edits now. Any help would be much appreciated. I really didn't think I was trying to do something that difficult, lol.
So I take it you want basically the difference between two lists. I've put this formula in the cell below the last entry in column B in Grades, hope this is what you want:
=filter(Data!A1:A40, iserror(match(Data!A1:A40, B5:B45, 0)))

Resources