Excel extraction from data without consistent pattern

Zaid Khan

datasnapshot

I have a huge dataset where one of the columns is in a format as given above. The thing is that I want to extract(cut) the name of the city(eg. VATICAN as given below) from the column and copy it to another column to the right side of it which is empty.

However the problem here is that for many records there is no information on the city. So is it possible to cut from the column(IF there is a '-' or ':' in the first few characters in the column and cut it from that column and paste in the same row but adjacent column)? Or is there another way round to do such a thing?

Desired Output: enter image description here

elserra

You could use the combination of =LEFT() and =SEARCH().

SEARCH gives you the characters position in a string and LEFT returns every character on the left of the position you want.

For example, for the Cell content in A1 = VATICAN - The Pope...
=SEARCH("-",A1) will give you 6
=LEFT(A1,6) will give you VATICAN -
and the combination
=LEFT(A1,SEARCH("-",A1)) will return VATICAN -

The same works for any other character as i.e. ; or :

Note that the LEFT() function will get you also the searched character. You can append a -1 after the SEARCH() function to avoid it.


If the character is not found, you will get an error, this is how you overcome it:
=IFERROR(RETURN,RETURN_IF_ERROR)

If you want to write for example (unknown) you should use
=IFERROR(LEFT(A1,SEARCH("-",A1)-1),"unknown") but you can also leave it blank by puttnig only "".


Concatenation:

You can concatenate this formulas several times to get different characters. Keep in mind that Excel will work the formula ltr.

If you want to search for "-" and, if not found, for ":" you would use:

=IFERROR(LEFT(A1,SEARCH("-",A1)-1),IFERROR(LEFT(A1,SEARCH(":",A1)-1),"unknown"))

EDIT:

If you want to look only in the first, let's say, 20 characters, just change SEARCH("-",A1) for SEARCH("-",LEFT(A1,20))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Excel data extraction from column

From Dev

Extraction of data from a file if pattern matches in Python

From Java

Data extraction from HTML

From Dev

find a pattern in string and remove that pattern of the string from excel cells without touching the pattern in the middle of the string

From Dev

Data and signal extraction from a file

From Dev

Data Extraction from a .seg file

From Dev

Consistent binary data from images in Swift

From Dev

Design pattern for different input parameter type and data extraction algorithm

From Dev

Match data without pattern matching

From Java

Python Data Extraction from an Encrypted PDF

From Dev

Data extraction from a text file using bash

From Dev

Extraction data from MySQL table using PHP

From Dev

Python Data Extraction from an Encrypted PDF

From Dev

Data extraction from a text file using bash

From Dev

Linux : Data extraction from text file

From Dev

Extraction and processing the data from txt file

From Dev

data extraction from xls using xlrd in python

From Dev

Extraction data from MySQL table using PHP

From Dev

Data Extraction from Poorly Structured XML File

From Dev

data extraction from textfile in python 3

From Dev

Data extraction from user defined attribute

From Dev

testing data pattern in excel file

From Dev

How to export tabular data from html to excel without columns merged

From Dev

Refreshing Excel data from an MS Access query without wrecking references?

From Dev

Scala, Pattern matching with no extraction

From Dev

java - Extract current date pattern from a String without knowing the pattern

From Dev

Extracting date from a string without pattern

From Dev

Extraction reactions data from facebook via restFb java api?

From Dev

Periodic Data Extraction From twitter4j Steaming API

Related Related

  1. 1

    Excel data extraction from column

  2. 2

    Extraction of data from a file if pattern matches in Python

  3. 3

    Data extraction from HTML

  4. 4

    find a pattern in string and remove that pattern of the string from excel cells without touching the pattern in the middle of the string

  5. 5

    Data and signal extraction from a file

  6. 6

    Data Extraction from a .seg file

  7. 7

    Consistent binary data from images in Swift

  8. 8

    Design pattern for different input parameter type and data extraction algorithm

  9. 9

    Match data without pattern matching

  10. 10

    Python Data Extraction from an Encrypted PDF

  11. 11

    Data extraction from a text file using bash

  12. 12

    Extraction data from MySQL table using PHP

  13. 13

    Python Data Extraction from an Encrypted PDF

  14. 14

    Data extraction from a text file using bash

  15. 15

    Linux : Data extraction from text file

  16. 16

    Extraction and processing the data from txt file

  17. 17

    data extraction from xls using xlrd in python

  18. 18

    Extraction data from MySQL table using PHP

  19. 19

    Data Extraction from Poorly Structured XML File

  20. 20

    data extraction from textfile in python 3

  21. 21

    Data extraction from user defined attribute

  22. 22

    testing data pattern in excel file

  23. 23

    How to export tabular data from html to excel without columns merged

  24. 24

    Refreshing Excel data from an MS Access query without wrecking references?

  25. 25

    Scala, Pattern matching with no extraction

  26. 26

    java - Extract current date pattern from a String without knowing the pattern

  27. 27

    Extracting date from a string without pattern

  28. 28

    Extraction reactions data from facebook via restFb java api?

  29. 29

    Periodic Data Extraction From twitter4j Steaming API

HotTag

Archive