vlookup for unsorted data does not work - excel

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

Related

Excel index match plus search

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 !!

How to search for one value in a column against all values in multiple columns in Excel

I tried a lot to find a solution for the below issue, lets say I have column A,C,D ; I want to take the fist value in column A and check if it exist in C or D entire columns; if exist then I will return A, then take the second value in A and search in C & D columns and so on.
The bottom line, is that I want to find the count of each value in column A that existed in C or D
Thanks
=COUNTIF(C:C,A1:A4)+COUNTIF(D:D,A1:A4)
Using SUMPRODUCT Function
Formula used in cell B2
=SUMPRODUCT((A2=$C$2:$C$7)+(A2=$D$2:$D$7))
And Fill Down!

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

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

extracting of specific values in a cell

I'm trying to extract specific values from a specific cell where Column A is the input and Column B is the output.
Column A Column B
AB,CD,EF,GH,IJ,KL ABCDEFGH
AB,CD,MN,EF,OP,UV ABCDEF
QR,AB,ST,CD,GH,WX ABCDGH
The formula i am using in Column B is:
=CONCATENATE(MID(A2,(SEARCH("A",A2,1)),2),MID(B2,(SEARCH("CD",B2,1)),2),MID(B2,(SEARCH("EF",B2,1)),2),MID(B2,(SEARCH("GH",B2,1)),2))
However if i am to drag down the formula until the last row, it will return a #VALUE! since some of the values in the SEARCH formula did not appear Column A.
So what I need is a generic formula that will only extract the values AB,CD,EF,GH OR whatever value is available in Column A just like in my example.
Best Regards,
I would condition on whether or not something exists, and print it accordingly:
Column B's formula uses an approach that matches
IF(ISERROR(FIND(<string>,<within_string>)),"",<string>)
and concatenates these using &. ISERROR avoids error outputs, while also helping to place content (an empty string "" in this case).

Resources