Excel index match plus search - excel

I have 4 columns
column A is the range for lookup
Column B is set of strings per cell in A
column C is the lookup value of the columnA
column D is a sentence that may/may not contain the string in column B.
I need to find first if C is in Column A and if found, i need to check if the value in column B in reference of the cell in A is present anywhere in cell D.
This may be confusing but let me put it in a image.
I tried using index match and search but always not referencing to what i want.
Hope you can help! Thanks

Besides the solution commented above, you may try this as well using XLOOKUP() & SEARCH() wrapped within an ISNUMBER()
• Formula used in cell E2
=ISNUMBER(SEARCH(XLOOKUP(C2:C5,A2:A5,B2:B5),D2:D5))
Or, without #SPILL
• Formula used in cell F2
=ISNUMBER(SEARCH(INDEX($B$2:$B$5,MATCH(C2,$A$2:$A$5,0)),D2))
Fill Down for the rest of the cells !!

Related

Excel using a range of cells to return value corresponding to an adjacent cell in the correct cell

I have been trying this for days, and can't get it correct.
I want to see if any value in column A matches any value in column C, and if so, return the value from column B into column D, BESIDE the match in column C.
I have tried all the suggestions for If, IFERROR, MATCH, VLOOKUP, etc, but can't get it to work. Any help would be most welcome!!
Here is a picture of my spreadsheet
Use a helper column:
In column D, use COUNTIF on each row to check the number of times that a cell in column A appears. =COUNTIF(C:C,A1).
In column E, use the formula =IF(D1>0, B1,"") and copy down
(you could of course combine these if you don't want to use the extra column)
Assuming you're starting in Row 1, in column D use:
=IF(COUNTIF($A:$A,$C1)>0,B1,"NO MATCH")
Drag that down as far as you need. This formula is saying: if the value in C1 matches anything in column A, then return the value from B1.
If this isn't what you mean, then please be clearer. Your data example is unreadable. Post a screenshot, or at least type it so it is in columns and rows. It's also unclear what you mean by "BESIDE the match in column C" What value is matching which value? That is, if A1 matches any value in C, do you want the value of B1 to show up in D1? Or do you want the value of B5 to show up in D5, if A1 matched C5?
In coumn D use formula
=IFERROR(VLOOKUP(C:C,A:B,2,0),"")
Note: this formula uses Implicit Intersection see here for some info

Excel - See if cells in one column contain text from another

Currently I am using the below to see if cells in column B exist in Column A...
=IF(ISERROR(MATCH(B1,A:A,0)),"False","True")
... However I've just realised the need to not check for an exact match, but rather if the cells in column B contain text that appear in any of the cells in column A.
For example, if a cell in column B contains "TIC081_CL1" then I could return "true" if column A contains a cell with only "TIC081"...
Can anyone help me with this please, as my current working only works for eact matches. Many thanks for any assistance!!!
Since it is guaranteed that there will be an underscore "_" separating the values you are searching for we only need to check 2 distinct conditions:
If the entire value B1 is found within A:A
If the value before the _ is found within A:A
We can accomplish that by using an additional MATCH derived from your original formula:
=IF(ISERROR(MATCH(MID(B1,1,FIND("_",B1)-1),A:A,0)),IF(ISERROR(MATCH(B1,A:A,0)),"False","True"),"True")
You can alternatively do this using 2 COUNTIF formulas:
=IF(COUNTIF(A:A,B1)+COUNTIF(A:A,MID(B1,1,FIND("_",B1)-1))>0,"True","False")

Is vlookup the correct thing to do to have the results next row

I'm using a vlookup to look for the all cells in the column D and see if they got a positive match in the C cells. If yes, I'm putting what is in the B cell next to the C cell.
In the example below, E2 will have what is inside of B2 after a lookup on D2 in the C column.
I've tried this formula but it is not the good one
=VLOOKUP(D2,C:C,0,FALSE)
I hope I don't need VBA
Best.
It is not completely clear exactly what you are looking for. I think you are trying to lookup data in column B based on a key in column C. If so what you want to use is
=INDEX(B:B,MATCH(D2,C:C,0))
As a breakdown, the MATCH will return a number representing which row within the range C:C matches the key D2. And, INDEX returns the element in B:B at row MATCH(D2,C:C,0).

Excel: Print Values from Column A not found in Column B in Column C

I have tried finding this solution on the web but have not had success for this specific problem. In Excel 2010 I have some data in column A where each value may partially contain data in column B.
EX:
Column A might contain "http://google.com/webmasters"
Column B might contain "google.com"
This should give me a match.
I want to print in Column C all values in column A that do not contain any values from column B.
EX:
Column A
http://dir.mydomain.tdl
http://myotherdomain.tdl
http://blog.otherdomain.tdl
http://www.lastdomain.tdl
Column B
mydomain.tdl
lastdomain.tdl
Column C (results required)
http://myotherdomain.tdl
http://blog.otherdomain.tdl
Any help would be greatly appreciated.
I think I have the solution using ARRAY formula. Assuming your input AND that columns A-C have titles, or simply, strings are listed starting cells A2 and B2, do the following:
C2: type the formula =IF(OR(NOT(ISERROR(SEARCH(INDIRECT("B2:B"&(COUNTA($B:$B))),$A2)))),"",$A2) but press CTRL+SHIFT+ENTER instead of usual ENTER - this will define an ARRAY formula and will result in {} brackets around it (but do NOT type them manually!).
Autofill formula in C2 until the end of list in column A, e.g. if the last value is in A100, then autofill up to C100 (how long column B does not matter here).
You may then copy & paste obtained results as values and sort out empty strings.
Here you go! The key here - we check every string in column A for having at least one match among array of strings in column B, and return empty string in case at least one match found.
For your convenience sample file is shared: https://www.dropbox.com/s/janf0xxon4z2yh5/DomainsLookup.xlsx
Maybe not the must efficient but you could simply use two arrays - one for Column A and one for Column B. Iterate through ColumnA array to see if it exists in ColumnB array (use Array.IndexOf or .contains). If it does you could remove it from the ColumnA array and output the remaining values in Column C as the remainder.

vlookup for unsorted data does not work

i have a table as following, i want to use vlookup but it does not work.
the format cell of column b and c is text. i wany to find the text in column B from column C.
my formula is:
=VLOOKUP(F5,B:C,1,FALSE)
f5=مركز بهداشت دانشگاه تهران
but it returns: #n/a
when i want to find column C from column B, it works well.
please help me. what should i do? is there any mismatch with arabic?
K_B's explanation of why your formula doesn't work is correct, you can't use VLookup to search column C and return from column B
You can use INDEX and MATCH instead, like this
=INDEX(B:B,MATCH(F5,C:C,0))
I'm not an Arabic speaker, but based on what you are saying, you have a value in cell F5 which you want to lookup in column B and return the corresponding value from column C.
Assuming that is correct, then your formula should read
=vlookup(F5, B:C, 2, FALSE)
However, that would not cause #n/a to be returned.
It does not look to me like the value given for F5 exists in column B in your example data - can you confirm?
The formula requires the text to be found to be in the 1st column from the second argument (B:C in your case).
Then it will return the value from the ith column to you where i is the 3rd argument of the formula (1 in your case).
This will only work 1 way (Search in B, return from C) and never the other way (search in C return from B).
If you require to work from the other way around you will have to either put the columns in the opposite order OR fill column D with =B1 etc... and use your formula on C:D.
Now whenever the searched text isnt present in your first column the result will always be #n/a

Resources