Tech Support Guy banner

Extract Text Before and After a specific character (Excel)

3.3K views 10 replies 3 participants last post by  Keebellah  
#1 ·
Hello all -

I want to extract the data in the first cell (A2) to the 3 separate columns so that it reads "Text1 in Col1, Text2 in Col2, and so on... I can find the formula for before OR after but not before AND after.

Col1Col2Col3etc
() Text1 () Text2 ()Text3

I used this in Col1 =IFERROR(LEFT(A2,FIND(" ( )",A2)-1),A2)
I tried this in Col2 =IFERROR(TEXTAFTER(A2,"( ) ",2),"") but it gives me Text 2 and Text 3

Thanks!
 
#5 ·
Here is the data I need to split... the following is in one cell and I need it to split the following using the "( )"

I didn't see anything in the video to help me - I have hundreds of lines:

( ) HOME SAFEGUARD INDUSTRIES INC Part No. 25S ( ) SAFETY SUPPLY CANADA LIMITED Part No. 863W001 ( ) HOME SAFEGUARD INDUSTRIES INC Part No. HOM32000 ( ) STEEL R FIRE EQUIP LTD Part No. SDT
 
#7 ·
Because you have so much data may I suggest another way to approach this.
Open your workbook and then save as a copy that is easy to find E.G Split test.
Make sure that you have the Split test document open and not the original file.
Go to the Home Tab>Find & Select
Click on Replace
Next to Find what: put your symbol ( )
Next to Replace with: put a comma ,
Click on replace all
When it is finished click on close.
Select all the data in column 1
Click on the Data Tab > Text to columns
In the Popup box click Delimited
In the list Click on Comma (untick any other boxes)
Click on next
You will notice the first column is black(the first comma)
Click on do not import column(skip)
For destination Put $B$1 to insert next to Column A
If you leave it as $A$1 it will overwrite Column A.

If this works as you want you can then do the same in the original file.
 
#8 ·
Post # 7 is the easiest method.
If you can not use this method and have to use formulas.
You are starting out with the wrong formula. The Left formula you have above in post # 1 leaves the brackets at the start.
Attached is a worksheet with three (3) formulas.
The formula in row 3 is the easiest in my opinion.
 

Attachments

#11 ·
If you are the one placing the delimiters I would suggest the | (pipe string) which is less common in textstrings, will give you must less headaches, brackets can be a niussance unless you're susre that they will always be there.
All you have to to is replace all the () with | and change that in PeterOz's sample file