Splitting Text

tc88

Board Regular
Joined
Jul 6, 2011
Messages
80
Text functions were never my specialty, but I am looking to create a lookup table for another worksheet based on the below information. I would like the numbers on the left side of the cell before the " -- " in the middle in one cell (say A2), and then the name on the other side of the " -- " in the next column (say B2).


Excel Workbook
D
1312487 -- Dummy Data
1412488 -- These can be variable in length
151004001 -- But I need the full text
1612720 -- Dummy data 2
Group Lookup Table
Excel 2010
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try like this

Excel Workbook
ABC
112487 -- Dummy Data12487Dummy Data
212488 -- These can be variable in length12488These can be variable in length
31004001 -- But I need the full text1004001But I need the full text
412720 -- Dummy data 212720Dummy data 2
Sheet4
 
Upvote 0
Try like this

Excel Workbook
ABC
112487 -- Dummy Data12487Dummy Data
212488 -- These can be variable in length12488These can be variable in length
31004001 -- But I need the full text1004001But I need the full text
412720 -- Dummy data 212720Dummy data 2
Sheet4

Bingo! Thanks a bunch, I knew I was missing something (forgot the LEN argument). This forum is great.
 
Upvote 0
You are welcome. You could also use Data > Text to Columns, Delimited, Specify Space and - as delimiters and tick Treat consecutive delimiters as one, then click Finish.
 
Upvote 0
Excel provides a button on the toolbar called Text To Columns. It resides on the DATA ribbon (data tools section)
Try that one out too.

Keep in mind you may want to convert the results of Peter's solution to values if you are deleting your Column A.

If you use the TtoC button you may need to rid yourself of leading spaces. ;)

Rob

Edit: treed :D
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top