Home » excel » Column parsing in Excel

# Column parsing in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

One of my excel columns like below.

``````COL A                COL B
----------------------------------------
ABCDEFGH             ABCDEFGH-#648-2011 EXT.8503
``````

In column C , I wanted value should be -#648-2011 EXT.8503

How can I do this in Excel?

I have tried formula like this :

``````=LEFT(B242,LEN(LEFT(A242,LEN(A242))))
``````

However, its not working, please suggest?

How to&Answers:

Looking at your data it seems that B2 has a value with A2 sticked to the left of it. If this is the case then you could use:

``````=RIGHT(B2,LEN(B2)-LEN(A2))
``````

If this isn’t the case and it is just a coincidence, then I agree with @Tim Biegeleisen his answer 🙂

EDIT:

Might you want to exclude the hyphen then use:

``````=RIGHT(B2,LEN(B2)-LEN(A2)-1)
``````

### Answer：

Many solutions:

You could replace the first instance of `A1-` in `B1` with a null string:

``````=SUBSTITUTE(B1,A1&"-","",1)
``````

or start after a certain location:

``````=MID(B1,LEN(A1)+2,99)
``````

If you really want to include the hyphen in the result in column C, then make the minor changes in the formulas above

``````=SUBSTITUTE(B1,A1,"",1)
=MID(B1,LEN(A1)+1,99)
``````

### Answer：

Try using this formula:

``````=MID(B1, FIND("-", B1), LEN(B1) - FIND("-", B1) + 1)
``````

This says to take a substring, starting at the position of the first dash `-`, for the remainder of the string after that starting point.