Friday 16 August 2013

Segregating data written in multiple lines in a single cell

We have been pressing Alt + Enter key to write in new line in same cell. However what about the vice versa case. If I get a list of countries all written in same cell; Of course I would not be able able to use any formula on that unless they are written separately, i.e each county name should be written individually in separate cells. So what is the solution?

Lets take a case study

Lets say I have copied a list of countries from a pdf file, which when pasted in Excel is pasted as shown below:


Now the challenge is I have to put all the countries in a validation list. Thus, for that my first task is they should be in separate cells, else they will be treated as single value.

Solution:

We are gonna use Text-To-Column wizard

So this is how we do

Step 1 : Select the cell that contains the names of countries (Cell B3 above).

Step 2 : Go to "Data" tab in the ribbon and select "Text-To-Columns".

Step 3 : Select the option as "Delimited" on the first page of the ribbon.

Step 4 : Select "Other" as the option in screen  2 of the wizard and
             press Ctrl + J on your keyboard.
             Notice the county names now shown in separate column 
             in the preview section of the screen.
             Now click Next.

Step 5 : Select a destination cell on screen 3 of the wizard and click finish.

You will notice the country names divided in cells.

Explanation:

Pressing Ctrl + J on the keyboard is the identifier of new line in Excel. We can use this in Find and Replace too. So suppose I want to add a hyphen ("-") at the end of each countries name. For this I can go in Replace dialogue box; Find Ctrl + J and Replace with - (Hyphen).





2 comments: