How to match a list to another in google spreadsheet? - google-sheets

Table 1
Name
Surname
Mike Senior
Smith
Sami Albert
Loris
Alfred Tony
Rene
Peter
Flore
Mike Junior
Peterson
Richard Smith
Verna
Table 2
Data
Surname
Barber mike senior
Cell 2
lawyer Alfred tony
Cell 4
chef richard smith
Cell 6
How can I find the correct surnames in Cell 2, Cell 4, Cell 6??
I tried vlookup but it needs an exact match.. it didn´t work.

Assuming you always have to extract the first word of the second table you can do this REGEXEXTRACT:
=REGEXEXTRACT(E2:E," (.+)")
Then, with Proper you can set them to have the first letter as capitals and insert them in VLOOKUP:
=VLOOKUP(PROPER(REGEXEXTRACT(E2:E," (.+)")),A:B,2,0))
And, finally, you can use them as an array if you want:
=ArrayFormula(IFERROR(VLOOKUP(PROPER(REGEXEXTRACT(E2:E," (.+)")),A:B,2,0)))

Related

How to combine Transpose, Concatenate & IF in excel/ google-sheets

Table 1
Employee
Country
John
USA
Davis
Australia
Maria
Australia
Nancy
USA
Table 2
Country
Employee
Clients
USA
??
Johnson
Twitter
FaceBook
IBM
RedHat
Phizer
?? should correspond to data from Table 1 with the Country filter.
For our example, it would be John, Nancy in the same cell, preferably in the next line (alt+enter)
John,
Nancy
I have tried to concatenate + transpose, but I am unable to make it work.
Moreover, I am unable to find any way to do the equivalent of sumif() in transpose.
On google-sheet you may try below formula-
=TEXTJOIN(CHAR(10),1,FILTER(A2:A,B2:B=H2))
CHAR(10) is for line break.
use:
=BYROW(D5:D10, LAMBDA(x, TEXTJOIN(CHAR(10), 1, IFERROR(FILTER(A:A, B:B=x)))))
In Excel use Pivot Tables:
Create a PivotTable to analyze worksheet data
Just take field Country and Employee into Rows section and Pivot Table will do the rest. Employees will not be in same cell, will be in different but it's the structure you want. And it's really really easy.

Remove Repeated "Inverted" Rows

Repeated rows maybe easy to filter but is there to remove repeated INVERTED rows from different columns in google sheets. Maybe it is easy but I've not had much luck so far with "unique" or "filter". The attached image should show what I'm looking to accomplish. Unique alone doesn't work because the second column (I)includes names from (H). So sheets looks at both columns as unique and returns them all. But this is like wanting to remove repeated first and last names, where the names might be inverted.
On the right is the result I'd like to achieve. Leaving only ONE match that would include the numeric values.
Appreciate any feedback. Thanks. 🙏
Get row number MATCH Name1 in Name2 Col. Get row number MATCH Name2 in Name1 Col. See if they are equal and whether the first MATCH is greater than or equal to the current row number.
=FILTER(A2:B7,IFNA(XMATCH(A2:A7,B2:B7)>=ROW(A2:A7)*(XMATCH(A2:A7,B2:B7)=XMATCH(B2:B7,A2:A7)),1))
Name1
Name2
Results
John
Doe
John
Doe
Dan
Jove
Dan
Jove
Doe
John
Jack
Tyler
Jack
Tyler
Jove
Dan
Doe
John
Another method would be to SORT BYROW and UNIQUE

How to apply =ARRAYFORMULA() to create a reversed numbered list in Google Sheets?

The formula has to be input on cell A2. The logic should be that the formula would result in the following cell (from cell A3 downwards) outputting a no. in a reversed numbered list format in column 1. And for those who are "Resigned" or "Dismissed" in column 3, the formula would skip them and the next numbering would be a follow-up from the previous no. instead.
We're using in-house software that's similar to Google Sheets and Microsoft Excel so certain functions/formulas like REGEX and custom functions are not supported.
No.
Name
Employment status
(insert formula here
Sample Name
Type of Employment
5
John
Full-time
Mary
Resigned
4
Jack
Part-time
3
Tim
Contract
Jane
Dismissed
2
Jonathan
Full-time
1
Larry
Part-time
This post is a repost from this ask as the solutions weren't applicable to this issue, unfortunately. So I'm looking for alternative solutions from those answers.
Alternative:
=ARRAYFORMULA(IF(MMULT(N(C2:C8={"Resigned","Dismissed"}),{1;1}),"",MMULT(N(ROW(C2:C8)<=TRANSPOSE(ROW(C2:C8))),1-ISNUMBER(MATCH(C2:C8,{"Resigned","Dismissed"},0)))))
Note that the oft-seen technique of replacing the upper cell reference in the range passed with a reference to the entire column (for example, C2:C) would here not be advisable. If such flexibility is required, suggest you create a dynamic Named Range.
can't be simpler:
=ARRAYFORMULA(IF((C2:C="contract")+(C2:C="part-time")+(C2:C="full-time"),
COUNTIFS(SUBSTITUTE(C2:C, "Contract", "time"), "*time", ROW(C2:C), ">="&ROW(C2:C)), ))
Paste this formula in A2
= {"Count" ; ArrayFormula(IFNA(IF(B3:B="",,VLOOKUP(B3:B, FILTER({ B3:C, SEQUENCE(ROWS(B3:B),1,COUNTA(B3:B),-1) }, C3:C<>"Resigned",C3:C<>"Dismissed"),3,0)),""))}

Comparing 2 columns for certain words

=COUNTIF(B4:B, "" & D4:D & "")
So column B4:B will have something like this
Joe Smith, STIM
and column D4:D would have something like this
Joe Smith 10/19/1999 AC
I am trying to make a True False statment in Col G that if column B has Joe Smith and Column D has Joe smith it will say yes or no. This will be a list of names that always change dynamically so one day B4 might be Joe Smith but the next day it could be Jan Doe. Column D will be a list of names in alpha order that changes all the time as well.
I was able to replicate what you need with the example provided by using:
=ArrayFormula(IF(D:D="",,REGEXMATCH(LOWER(D:D),FILTER(LOWER(I:I),I:I<>"")&"\b")))
You can see the results in my testing spreadsheet here.
At the moment I have limited the range from column I but you can just change it so it takes the whole column.
Just one little detail is that with this function you can only have 1 name in each row in the list of names.

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