extracting of specific values in a cell - excel

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

Related

How to concatenate a column value based on another column value in excel?

I have sheet like this :
How can I concatenate values in column B based on value in column A.
Values corresponding to ID 1.1.1 are of B2:B5
Similarly, values for ID 1.1.2 are of B6:B8 and so on..
Its like it start from first id, lookup until next id, all values in column B until next Id in column A is concatenated
the result should be like this : 2,3,4,5 in single cell of column D
I am not sure if this would solve your purpose, but you can keep concatenating values till the value in column A is same and use the last value.
Assuming the case you provided, paste the formula =IF(A2<>"",B2,D1&", "&B2) in cell D2 and copy throughout the column. You can additionally create a flag for changes in column E using =IF(A2<>"",1,"") in cell E2. The results would be like this.
It's still not quite clear, what you are trying to achieve, but to simply concatenate columns with a comma as separator, you can try something like the following:
In column d2 (or column d5), type in the following formula
=B2&","&B3&","&B4&","&B5
That should get you in the right direction.

Excel substitute for FIND Function when searching for multiple criteria

I want to find whether a given cell has a value that is included in a list. Then I want to make the equation dynamic so that it results in a different output based on which item in the list it is. There should be an equation in column B (Index/Match?) that returns a value from column D based on whether the value in column A contains one of the codes in Column C.
Column A Column B Column C Column D
ABC12D Equation=$40 ABC $40
XYZ15Q Equation=$20 MNO $30
MNO26P Equation=$30 XYZ $20
With you setup you would use INDEX/MATCH with your FIND as an array formuls:
=INDEX($D$1:$D$3,MATCH(TRUE,ISNUMBER(FIND($C$1:$C$3,A1)),0))
being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
The or statement in the excel function tests a series of logical statements. What you want is something more along the lines of the following.
{=TEXTJOIN(", ",TRUE,IF(IFERROR(FIND(B1,A$1:A$5),"ERROR")<>"ERROR",ROW(A$1:A$5),""))}
This function could be pasted in Column C, for each item in Column B you are testing.
This is an array function, and after you enter it in the cell, you need to use Ctrl+Shift+Enter to make it work
This function will search for the text in B1 in the range A1:A5 and report what coulmns it finds the text in B1 seperated by a comma and a space. In your example case, it woudl return 1. If abc was also present in the third entry in Column A, then it would retrun 1, 3
Just as a breakdown,
FIND(B1,A$1:A$5) searches for the text in B1 in the range A1:A5. It returns an array with the location of the text, in your example, it would return {1,#VALUE,#VALUE}
Since if the FIND funcition cannot locate the specified text, it returns the #VALUE error. IFERROR(____,"ERROR") catches #VALUE and replaces it with "ERROR". It modifies your array to {1,"ERROR","ERROR"}
The if statement IF(___,ROW(A$1:A$5),"") will return the row of the array if the array value is not "ERROR", otherwise it will return a blank space. This will modify your array to {1,"",""}.
The TEXTJOIN(", ",TRUE,_____) statement joins the array together, seperated by a comma and a space. The TRUE argument skips blank sections of the array.
If you want to return a custom value based on what row it occurs in, you can replace ROW(A$1:A$5) with the range that has the corresponding value.

Excel VLOOKUP N/A error

I have a table setup like this:
I am trying to do a lookup, where Column D value matched one of the Column A values and returns Column C value.
The numbers in column A and D are stored as text.
My formula is VLOOKUP(F3,A1:C3,3,TRUE) but this returns "Value not available error". What is wrong with the formula?
EDIT
Figured out that some of the values were stored as general.
Now the problem is that I have to get an exact match with leading zeroes.
For example in Column D I have "27154" but in Column A I have "000027154", these should match.
But if I have "000271540" or any other variant in Column A, it should not match.
All the numbers in Column A are 9 digits long with leading zeroes where needed.
VLOOKUP(TEXT(F3, "000000000"),A1:C3,3,FALSE)
It will require creating the same value for the VLOOKUP to find the value. Looking at your example, the length of the text in column A is 9 characters. As a result, the padding is applied which will be used to search. To make it exact match, FALSE is used as last argument to VLOOKUP.
You can use wildcards in VLOOKUP:
=VLOOKUP("*"&F3,A2:C3,3,FALSE)
There's nothing wrong with the formula. The problem is that the value in A2 is text and treated as text when comparing to the number in F3.
If you can't change your values in column A, then you can use this array formula:
=SUM((F3=VALUE(A2:A3))*(C2:C3))
Enter with CTRL+SHIFT+ENTER
This will convert the values in A2:A3 as numbers for the comparison against F3.

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