Find the position of a related string in a list - excel

In my worksheet, B2:F2 and B8:D8 are already filled in.
I would like to find the formulas for B9:D9. For instance, B9 is 2 because we can find Lee in Lee XXXX and Lee is at the second place of B2:F2. C9 is 4 because we can find Jim in Jim XXXX and Jim is at the second place of B2:F2.
To check the relation of Lee and Lee XXXX (Jim and Jim XXXX), we could use SEARCH, left_substring (if such a function exists).
Both single formulas or array formula will be fine. Using LAMBDA function is secondary choice, because it is still in preview.
Could anyone help?

If what is needed is always the first "word":
=MATCH(LEFT(B8,FIND(" ",B8)-1),$B$2:$F$2,0)
If you want to search on any position in the string:
=AGGREGATE(15,7,(COLUMN($B$2:$F$2)-MIN(COLUMN($B$2:$F$2))+1)/(ISNUMBER(SEARCH(" "&$B$2:$F$2&" "," "&B8&" "))),1)
With FILTER instead of AGGREGATE:
=#FILTER((COLUMN($B$2:$F$2)-MIN(COLUMN($B$2:$F$2))+1),ISNUMBER(SEARCH(" "&$B$2:$F$2&" "," "&B8&" ")),"")

Related

Case sensitive problem in Excel’s pivot table

Example below, the ID of people are case sensitive (if don’t consider the case, some of them are of the same, for example, David’s and Mike’s, Lilly’s and John’s).
When putting them into a pivot table, it displays the same IDs for different people, i.e. David’s = Mike’s, Lilly’s = John’s.
Is there a way to have the pivot table to display actual IDs (case sensitive)?
ID Name
Txze David
TxZe Mike
TwgQ Lucy
3RqM Lilly
3RQm John
TvrE Kate
So, had a quick go with index() and match() as suggested in my comment:
INDEX(A$2:A$7,MATCH(D2,$B$2:$B$7,0))
D2 and D4 contain the Name looked for and the results are in F2 & F4, which give the different results. Note, 0 is used for an exact match in the match function.

Excel formula: search in column by another value (LIKE)

I'm having a problem in Excel, where I'm trying to search an entire column for a name (not necessarily 100% identical) that is in another column.
The following table for a better explanation:
---------------------------------------
NAME CITY FATHER NAME
---------------------------------------
Saad Test New York William Jack
Jack Jacking Paris Noah Saad
Adam King Rabat William Sara
Sara Best Madrid Benjamin Adam
Briefly: I want to get the father's name by using only the name column. Is there a way to do that? (The order of the fathers’ names is incorrect, so I want to search using the name, if it is present in the father’s name, then it is the result I want)
Example: Saad test his father's name is Noah Saad (Match by Saad)
PS: I tried using LOOKUP, VLOOKUP and MATCH, but unfortunately the result is always N/A
PS 2: The data I have in Arabic is the reason why the above functions are not working?
I would use index() with match(), assuming your data starts in cell A1, like so:
=index(C1:C4,match(F1,A1:A4,0))
F1 contains the name that you look for.
Note, the classic problem is that there are extra spaces (leading or trailing) that make the names not identical.
You can trap errors as so:
=iferror(index(C1:C4,match(F1,A1:A4,0)),"Check")
You could do:
=INDEX( $C$2:$C$5, MATCH( "*" & MID( A2, 1, FIND( " ", A2 )-1), $C$2:$C$5,0) )
SolarMike - I think you have said the same, so I'm sorry if I am
stepping on your answer.

Task complete excel function

I have a 2 tables one is the DB and other is the UI; My EmployeeDB table is something like this:
Name: Task 1 Task 2 Task 3
John Smith X X X
Alexandra Kole X X
Jane Austin X
And in my UI table I have employee names in the first column, and I want to show the status of whether all the tasks are completed or not. So it has to be something like this.
Name: Status
John Smith Complete
Alexandra Kole Incomplete
Jane Austin Incomplete
I have this formula that I have pasted to the Status column of this table:
=IF(EmployeeDB[Name]=B4;IF(OR(EmployeeDB[Task 1]=""; EmployeeDB[Task 2]=""; EmployeeDB[Task 3]=""); "Incomplete"; "Complete"); "n.a").
But it only works for the first employee in the status table, for the others, the result is n.a, even though the employee is on the DB.
Could you please state what is the problem, and how it can be fixed?
Try,
=IF(COUNTA(INDEX(DB[[Task 1]:[Task 3]], MATCH([#[Name:]], DB[Name:], 0), 0))=3, "Complete", "Incomplete")
You already have a nice solution given which avoids volatile Indirect. Here is with indirect
H2 drag down
=IF(NOT(COUNTBLANK(OFFSET(INDIRECT(CELL("ADDRESS",INDEX(A2,MATCH($G2,$A2:$A4,0)))),,1,1,3))),"COMPLETE","INCOMPLETE")
Data
This will work:
Under presumption your data starts at B2 and ends at let's say D2,
like so:
Then the following formula will work.
=IF(COUNTA(B2:D2) = COLUMNS(B2:D2), "Complete", "Incomplete")
This solution is however very simplified, if you want to match the names to specific index, you should use the solution #QHarr provided. This should only illustrate an easy workaround.

VLOOKUP with conditions

I have an issue at the moment which I'm not able to resolve even with multiple combinations of If and Vlookups. I'm not doing this right.
I have a sheet which has the names of the products and an empty column for the Sl Number. The Sl number needs to be retrieved from Sheet 2 if it matches the value in the adjacent cell of the formula (This I know can be possible with Vlookup). However, I am trying to display the value even if the match is not exact. By that I mean if the product name has all the values as on the sheet 1 but also has additional information in brackets, then the value should still be displayed.
Sheet 1
Formula in A2 - A7 = "=VLOOKUP(B2, Sheet2!B:E, 2, 0)"
Sheet 2
The complete data
Is this possible?
Thanks in advance.
Apologies, I'm new here and not sure how this works. So trying to do the right thing but may take some time.
Thanks Frank and Tim. I have another extended question to this.
Is there a way to retrieve the value by ignoring text in brackets on the lookup cell itself?
For example:
Sheet 1
Sl Number Name
123454 Cream SPF 30+ 50g
**NA** Bar Chocolate 70g X 6 (Sample)
234256 Hand Wash 150ml
26786 Toothpaste - Whitening 110g
Sheet 2
ID Name Sl number Manufacturer Quantity
8 Collagen Essence 10ml 456788 AL 87
9 Hand Wash 150ml 234256 AD 23
10 Bar Chocolate 70g X 6 835424 AU 234
Row 2 on Sheet 1 has the name that includes (Sample) and the same product on sheet 2 does not contain the (Sample) for that product. Is there a way I can use lookup in the above scenario?
Thank you
Tim's comment
=VLOOKUP(B2 & "*", Sheet2!B:E, 2, 0) as long as the "Extra" info is tagged onto the end of the name, and none of your product names is a
substring of another product name. – Tim Williams 53 mins ago
Will get what you are looking for, as for getting rid of text between "(...)" use
=IFERROR(IF(FIND("(",A2),LEFT(A2,FIND("(",A2)-1),A2),A2)
To create a new column that will cut out anything that has parentheses "(...)" this presumes that all of your entries has the "(...)" at the end, i.e. far right side.
As you are new, I presume you might be interested in an explanation. I'll explain what Tim and I did. If I am incorrect, anyone is free to edit.
Based on your question, it would appear that you are familiar with Excel but not the site. This said, my understanding of the key difference between your attempt and Tim's was =VLOOKUP(B2 & "*", Sheet2!B:E, 2, 0) or specifically & "*". This introduces a Wildcard to the search parameter. So if you typed "Bob" but the actual reference was "Bob's Burger" That "*" would allow ['s Burger] to be included as part of the possible search given that you set vLookup to search for Approximate rather than exact matches. =VLOOKUP(B2 & "*", Sheet2!B:E, 2, 0) specifically , 0).
As for my part, IFERROR is effectively an catch-all for errors in IF functions. If there is a error, then X. In this case, if it does not find "(" in the cell, then it will throw an error. Since it is an error, display the original cell.
As for IF(FIND("(",A2),LEFT(A2,FIND("(",A2)-1),A2) It asks Excel to look for "(" in the cell A2, if it finds it, then it it counts from the LEFT until it finds the "(" and deletes the text one space to the left of the first "(". Thus removing the "(...)".

Search for a specific word stored in one column which has so much data

I have a free text column full of contact details. I want to extract realtion ship out of the contact details. I tried different formulas, but didnt work. Even I have added a column with relationship status and tried
=INDEX(D$2:D$5,MATCH(1,IF(ISERROR(SEARCH(D$2:D$5,A2)),0,1),0),1)
but it didnt work.
For ex:
Contact Details Column:
Matthew Brown: Wife: 937268475663 (home) or 939848399384 (mobile)
Bill Benoit: Father: 7494785736784
Spouse - Matha Nocon - 948479 289374
Mrs Elaine Batty: Wife: 29474567334
Iain Beveridge020 8877 3537
Janice Waddy01482 581000 Work 07986501322 Mobile
Tony Salter (Father)Tel: 0207 583 5000
Mrs Amanda Bluff - 01507 466198
Paula Washburn[Sister] - 87362 741895 [Home]
Cliff Potter (Husband) - 0263 88472363(Work)
I want an excle formula that searches relationship from ralationship status column inside the contact details column and extract relationship (wife, husband, etc.).
Hi Kaliakanhu Panigrahi,
You use array in your formula and you forgot put it on {}.
You can do it by pressing Ctrl + Shift + Enter when you are in the formula cell.
When I did this it works fine for me.

Resources