Extract text between two characters multiple times on multiple lines in Excel - excel

I want to find an easy way to extract text between characters multiple times within the same cell. So in the example below, I want to take the information between the parenthesis and get them into the adjacent column, as shown. Is there a fast way to do this?
My process has been to use Text to Columns to separate them out into different cells, then use a mid function to get what's between the parenthesis, and string them all back together. I'm wondering if someone can think of a better way to do this. Thank you!
I should note-- I want to do this entirely within excel.

For example:
Formula in B1:
=TEXTJOIN(CHAR(10),1,LEFT(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1," (",CHAR(10)),CHAR(10),"</s><s>")&"</s></t>","//s[substring(.,1,3)*0=0]"),3))
Enter as array!
If you are interested in FILTERXML, you might want to have a look at this.

Assuming the 1st data is in A1, put :
=REPLACE(A1,1,FIND("(",A1),"") in C1
then,
=IFERROR(REPLACE(C1,FIND(")",C1),FIND("(",C1)-FIND(")",C1)+1," "),C1) in D1
and drag D1 to Q1. lastly, put
=Q1 in B1.
That shall do it.
Idea : replace all text between the ) & ( with a space, 15 times.
hope it helps.

Related

Repetitive autoincrement between spaces

I would like to know how to write a number under a cell with text, then write that same number until it finds another text, then increment it and do the same over and over. Keep in mind that we dont know how many spaces will it be between each text.
Here is a image of what I mean, its very clear here:
I am no expert on excel just used it a few times and know the basics but I really need this formula to avoid hours and hours of work doing this manually. You would help me a lot.
Without vba, you need a separate column and this formula:
=IF(E1="",COUNTA(E1:$E$1),E1)
The trick is in the range, which is always starting with E1, because of the two $-signs, but ending with the pulled row. Then simply pull down column F, it will increment:

Extract text from a string in excel

I want to extract the Test #. and the description that follows into two different columns side by side. Currently I have one long string. I want to break the string into two sets and extract only the needed information.
I have attached a screenshot to make it more clear. In the past I have used the MID function and FIND to extract text from strings, but since the strings here vary in length and content I'm not sure how to do this.
Thank you in advance!!
Formula for cell A9:
= LEFT(A2,FIND(".",A2)-1)
Formula for cell B9:
= MID(A2,FIND(". ",A2)+2,FIND(" .",A2)-FIND(". ",A2)-2)
Drag formulas down as far as necessary.

CELL("contents", ) in EXCEL

I have a cell (A1) in sheet 4 that is containing the following formula:
=CELL("contents",Sheet1!B61)
However, I want to find the content of the result. When I try to formulate it
=CELL("contents",A1)
The result is the same.
What I want to find is the content of =CELL("contents",Sheet1!B61). Is it possible to enclose it with a cell function twice? I've been trying to formulate it but there is always an error.
I cannot imagine a scenario in which it would be necessary to generate text strings representing cell addresses and then reference these in formulas. However:
=CELL("contents",INDIRECT(Sheet1!B61))
is what you require.
Regards
=CELL("contents",Sheet1!B61) is the same as =Sheet1!B61.
I think you are looking for INDIRECT which will translate a cell address given as text to the value contained in the cell.
=INDIRECT(Sheet1!B61)
Idk, try a nested CELL(CELL=(...)) not sure if it will work but...
Also, can you clarify exactly what you want? When you have
=CELL("contents",Sheet1!B61)
I assume the result is a number or text or whatever
Then you say, "I want to find the content of the result". What do you mean here? You want the cell (A1) in sheet 4 to display something other than the result of the formula above? If so, just change the formula. I think I'm a little lost here...

VLookup not returning the results

I'm not sure why my VLOOKUP formula is not working like the screenshot below. The value is right there as highlighted. I want to output the value in Column G, but changing the 3rd parameter to 1 or 2 doesn't work.
Help is appreciated. Thanks much in advance.
Formula: =VLOOKUP(B2,$F$1:$G$421,2,FALSE)
One thing you may want to look at.
I notice your data is left justified and that's normally the case for textual rather than numeric fields - it's possible to left justify numerics but it's neither the default nor the general practice.
If they are textual, there's a chance one or more of them may have leading or trailing spaces. That would prevent the lookup from finding a match.
Select (in turn) B2 and F1 and use the arrow keys in the formula box to check this is not the case.
In cases like this, I tend to (temporarily) set B2 to the formula =F1 just to see if it can find a match that's guaranteed (then use CTRL-Z to revert).
If that change results in the lookup working then obviously the (original) B2 and F1 are not the same value, and you need to work out why (hidden spaces, wrong types, and so on).
It looks like you are comparing text to number (see the green triangle in your value cell). You have to convert the value in your source cell or matching cells to same type. To convert source to number use excel function such as int or value. Hope this helps.
Another way to convert text to number format is to multiply by 1 and then replace original text values with these new number values...
If you are doing lookup where you have a mix of text and numbers (i.e. looking up a text version of a number in a list of real numbers) you can also make use of the VALUE function... this will convert numbers stored as text to real numbers.
Embed it like so:
=VLOOKUP(VALUE(B2),$F$1:$G$421,1,FALSE)
If you have a mix of text numbers and text text to look up in numbers/text then you can do:
=VLOOKUP(IFERROR(VALUE(B2),B2),$F$1:$G$421,1,FALSE)
to change numbers stored as text to numbers, but leave other text as is...

How do I remove duplicate content within a sigle excel cell

I have individual cells in excel with the following content in each of them
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg
This is one cell in a long row for a dump of data for products within an ecommerce site. A data migration has somehow added the same image more than once to the same product. Each separate image image is separated by the Pipe "|" symbol.
I want to search each cell in this column of the sheet and remove the duplicated image reference and the Pipe symbol.
So the examples above become
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
and
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg
The suggested answer of finding the pipe with SEARCH is a good general answer, however in this instance as the source string is always twice the length of the desired we can just chop it in half with the formula below and drag it down.
=LEFT(A1,(LEN(A1)-1)/2)
In addition to a formula, you can use Data>Text to Columns, which is a good thing to know about. Select the entire column and then you up the dialog. In step one choose "Delimited" and in step two choose the pipe symbol:
When you're finished, delete the first column.
I figured out that this works for some more complex scenarios. I think it should work for this one as well.
=IFERROR(LEFT(C2,(FIND(LEFT(C2,20),C2,2)-2)),C2)
I entered this into D2 and copied it all the way down the column. I then copied and pasted the values back into Column C.
The problem I had was that not all of the cells in my column had duplicate text. Of those that did, the duplications were not delineated by any unique character (There was a single space in front of each duplication.), and the duplicated text was often an incomplete duplication so the length was not consistently symmetrical.
The "20" is an arbitrary number of characters I picked for excel to use from the front of the text to identify where the text started to repeat. There are enough people here who know excel better than I who can explain what the rest of the formula does. I figured it out by poking around.

Resources