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

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.)

Related

How to remove a piece of text from a cell?

I'm trying to remove a piece of text (Perfomance) from a column in Google Spreadsheet that contains (XX Performance) XX is a number like 89. I'm using:
=REGEXREPLACE(D:D, " Performance "," - ")
But no love...
enter image description here
Try this Example Sheet
=ArrayFormula(IF(D2:D="",, REGEXEXTRACT(D2:D, "[0-9]+")))
You can use the expression \D+:
\D matches any character that's not a digit (equivalent to [^0-9])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed
The formula will be like:
=REGEXREPLACE(D:D, "\D+","")
UPDATE
I did put it in another column otherwise it creates a circular dependency. The data is imported via API from another app.
Then you will need to create another sheet or use a hidden column to put that information and then use the regex on the column you want the final result.

Google Sheets - Iterate through text string, removing charters from end until a vlookup match

A user pastes in a value to see if there is a full or partial match. I need to do a vlookup and keep removing characters until there is a match. A full match of something like test1.test2.test3 is no problem because it's a full match to my list. But if someone pastes in something like test1.test2.test3.test4, I need to remove a character one at a time from the end until there is a match. So in this example, it would match test1.test2.test3 and return that result.
Conceptually I see this as a for loop that counts the characters using len, using left to remove the number of characters from the end based on the current iteration, and doing vlookups until returning the value when true. But I'm not sure how to do this in Google Sheets.
This formula will give you the matching value that was found in the data(i.e. test1.test2.test3)
=FILTER([column_with_data], REGEXMATCH([cell_with_pasted_value_to_look], [column_with_data]))
This formula will give you the matching data and the cell reference where it was found (i.e. test1.test2.test3 # $A$4)
=FILTER([column_with_data], REGEXMATCH([cell_with_pasted_value_to_look], [column_with_data]))&" # "&CELL("address",INDEX([column_with_data],MATCH(FILTER([column_with_data], REGEXMATCH([cell_with_pasted_value_to_look], [column_with_data])),[column_with_data],0),1))
Simply copy & paste any of the above formulas next to the cell where users paste a value to look. Then, replace the two references in the square brackets [ ] with the proper coordinates in your sheet:
replace [column_with_data] with the coordinates of the column containing all the stored data (i.e. A1:A)
replace [cell_with_pasted_value_to_look] with the absolute ($col$row)coordinates of the cell where users paste the value to look (i.e. $B$1)
Would it be a problem to download the data from Google sheets, transform the file type to use the for loop in another software, and re-upload? I think your idea for a for loop would work.
It might be quicker if this is a long term project, but not so great if the client is continually monitoring/uploading.

multiple if conditions nested with a concatenate - Google Sheets

I have a formula as follows which I'm using for a scheduling system within Google Sheets:
=IF(B2="","",(CONCATENATE($B$1&" "&B2&CHAR(10)&$C$1&" "&C2&CHAR(10)&$D$1&" "&D2&CHAR(10)&$E$1&" " &E2&CHAR(10)&$F$1&" " &F2&CHAR(10)&$G$1&" " &G2)))
currently my formula works b2 has a value inside it which is great, what I want however, is for the formula only to show if one value is inside either.
B2, C2, D2, E2, F2 or G2.
so if c2 has a value I want the formula to parse.
I've tried
=IF(B2,C2,E2) etc with no luck.
I've also tried:
=IF(OR(B2="",C2="") which parsed the formula but kept it visible even with no data.
Reason for this is that I pull these fields into a master schedule and I only want it to show when one of the fields is populated, if that makes sense? otherwise the schedule will look far to busy.
https://docs.google.com/spreadsheets/d/1KE3VOI43M4-QlWB0EZldCqR73d3RHDnRnUNlv1MqLMo/edit?usp=sharing
Document for you guys.
Cheers!
If your goal is to show a formula when any of a given range of cells is not empty (and display nothing if they are all empty), you can simplify your condition check by first joining all ranges, and then comparing to the empty string:
=IF(JOIN("", B2:G2)="", "", "Your Formula")
You need to use AND() instead of OR().
=IF(AND(B2="", C2=""), "", "Formula")
Also, although this makes the formulas longer, I do prefer to use a combination of IFERROR(), ISBLANK(), and NA(). I prefer this because a blank cell is not the same as one with an empty string in it. So my preferred way of writing the above would actually be:
=IFERROR(IF(AND(ISBLANK(B2), ISBLANK(C2)), NA(), "Formula"))
just another solution I came across which I thought was much better than my own and made the data above a little tidier.
=IF(A2<>"",CONCATENATE(IF(B2<>"",$B$1&": "&B2&CHAR(10),),
IF(C2<>"",$C$1&": "&C2&IF(OR(D2<>"",E2<>"",F2<>"",G2<>""),CHAR(10),),),
Essentially this will populate only whats selected instead of populating all the fields in headers and then populating the scheduled work stream.

Google Sheets Query referencing a cell's text

When I perform this function, it works:
=Query(CRM!1:1085,"Select B where D contains 'FirstName LastName' ",4)
When I perform this one, where B31 is where the text "FirstName LastName" is located in the sheet, the output is only ONE of the many results:
=Query(CRM!1:1085,"Select B where D contains '&B31&' ",4)
I want to be able to use the cell rather than write the quoted text in the formula. This is because I need to quickly replicate the formula for many different values. Also because it needs to be automated in case of changes in the source.
B31 is interpreted as literal string, when you use just 'B31'. You need to use double quotes along with single ones and concatenate:
'"&B31&"'

Error when using match and indirect in Google Sheet

I have to make a conditional formating formula with cross-sheet references.
Basically I have many sheets, one with existing words, and another one with words we have to add. I want to highlight in "Feuille 6" the words that are already in "Existant". I tried many formulas, I read the doc, I still can't figure it out.
Quick edit : equiv = match, and ligne = row, it's just google sheet translating words into French..
Here's the formula I think I should use, but it's not working
=EQUIV(A,indirect("Sheet1!A"&LIGNE()))
Here's what the Feuille 6 looks like
Again, there should be highlighted words in Feuille 6, like " Action ", which already exists in the sheet " Existant ".
I tried replacing "Sheet1 "with "Existant" too.
Any tip please?
Thanks !
Try:
Assuming the sheet Existant has values in columns A to Z , and you are highlighting cells in column A
=countif(indirect("Existant!A:Z"), A1)

Resources