How to split a column, by a specific word - excel

Scenario: I have a field for address, however we need to upload it to a database and the way it was formatted was the whole address, when in reality we needed, the address, state and zip separately.
attempts: I tried using the Text To Columns and Delimited function in excel but I can only split it by like, commas, spaces, etc.
Goal: Is there a way to split it using a word like, "FL" or "PORT SAINT LUCIE"?
Example of address: ="1459 SE BURKAY AVE PORT SAINT LUCIE FL 34563"

Easiest way to resolve this issue without VBA Makro is to find and replace the specific word preceded by a comma so as to choose your delimiter that way.

Related

How to extract the text between many commas in excel

I have a problem to extract the suburb from a address.
For example, the dress is "143 Stephanie St, Upper Kedron, QLD, 4055."
How to set up a formula to extract the buburb, Upper Kedron, from the address?
I really appreciate your review :)
This will extract second word separated by comma:
=TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",255)),255,255))
You will have problem if Upper Kedron is not 2nd word like for example:
143, Stephanie St, Upper Kedron, QLD, 4055 (this will extract Stephanie St).
So if you have cases that formula doesn't work give us more inputs.
As per the previous answer, looks like your suburb can be in any position. So the best way is to split the address to multiple columns and then choose a column of your suburb.
=TRIM(MID(SUBSTITUTE($A1,",",REPT(" ",999)),1+((COLUMN(A1)-1)*999),999))

Vlookup Not working on text between two tables

This is not your average vlookup error.
I have two Power Query tables that I've setup. One is coming from a CSV file with a list of names. The other is from a website pulling a list of names.
i.e.
=John Smith = John Smith would not be true for some reason.
They vlookup should be able to find the name easily. I've tried proper,upper, clean, trimming and text to columns and everything else that I could think of. I've changed data types to no avail.
I know that one query is causing the issue. I can type the name exactly and do a vlookup from one, and it works. The second query that I do this to doesn't return anything on the typed text.
Anyone encounter this issue while using Power Query?
EDIT: See Jeeped's Answer - When I replace the space from the web query with a normal space it works.
#Jeeped's comment has a good answer:
Assuming you have already trimmed off leading and trailing spaces, one of the John Smith entries (likely the one from the web) uses a non-breaking space (e.e. CHAR(160) or ASCII 0×A0) instead of a regular space (e.g CHAR(32) or ASCII 0×20). Use
=CODE(MID(A$1, ROW(1:1), 1))
on both, fill down to get a ASCII code for each letter and compare the numbers.

Excel First Word (with error checking)

While I can extract the first word from a cell containing multiple text values with error checking to return the only word if no multiple values exist. I cannot seem to wrap my brain around adding more checks (or if it is even possible in the same nested formula) for situations where some of the source cells contain a comma between multiple words. Example, the formula below will return "James" from "James Marriott". But, it returns "James," from "James, Marriott". If all of my cells in the range were consistent that would be easy, but they aren't. Attempts to nest multiple find statements have resulted in failure. Suggestions?
=IFERROR(LEFT(A1,FIND(" ",A2)-1),A2)
To compound matters, there are also cells that contain abbreviations as the first word, so somehow I need to account for that as well. For example "J.W. Marriott" where I need to apply the above logic to extract "Marriott".
Here are some examples below:
Text Desired output
James Marriott James
James, Marriott James
Able Acme Able
Golden, Eagle Golden
J.W. Marriott Marriott
A.B. Acme Acme
you could use regex (to set up please look at the post here)
Then you can extract the desired word with a formula like:
=regex(A1, "(?![Etc])[a-zA-Z]{2,}")
(This is searching for a pattern of two or more lower or upper case letters in the cell A1...and not searching for Etc)

Excel - present word between certain characters

I am trying to split some data up but stuck! I have some data which comes out like the below:
USERNAME Full Name Department
USERNAME First Initial Surname Department
USERNAME Full Name Department
I have tried numerous items such as trim then can pull out words however some peoples full names are 3 words and most of them are 2 words so this kinda breaks it all.
I have also tried substituting the double spaces so it breaks it up like so
##USERNAME#######Full Name######Department###########
##USERNAME###First Initial Surname Department#
##USERNAME###########Full Name#####Department#####
But still unsure how I can pick up the words between the hashes.
Help really appreciated :)
If you have a text file with the raw data, separate the raw data using either of a TAB, a semi-colon, or a comma. Pick something you do not already have in your file. Semi-colon usually works for me.
Then, open it as a CSV (comma-separated values) file in Excel.
It will try to parse the file automatically. If it doesn't succeed, it will ask you what character you want to use as a separator.
You mentioned double spaces seperating your data, that's your ticket in.
Let's say you've got "USERNAME David Brossard DEPT" in Cell A2.
In B2, let's FIND the first double space:
=FIND(" ",A2)
In C2, let's FIND the second double space:
=FIND(" ",A2,B2+1)
In D2, we'll grab everything in between:
=MID(A2,B2+2,C2-(B2+2))
There you go!
Alternatively, you can write it all in one formula, in B2:
=MID(A2,FIND(" ",A2)+2,FIND(" ",A2,FIND(" ",A2)+1)-(FIND(" ",A2)+2))

Use of Excel text parsing functions to extract from a string with complex format

I have a list of items, with a sample as such:
(CompanyName){space}(PartNumber ending with -){space}(Revision Level).pdf
Company 100-50006- Rev. A.pdf
Company Two 6001241- Rev. CN.pdf
CompanyThree 109581- Rev. B.pdf
My goal is to get three unique pieces of information using Excel: Company Name, Part Number, Revision.
The revision is easy to capture. I am trying to find a way to capture the Company (segregating from the first appearance of any Numeric value). I am also trying to find a way to capture the whole part number.
What function can I use to locate the first numeric character, and do a LEFT(A2,LEN(FUNCTION HERE)-1) where the -1 is due to the spacing?
Similarly, I want to do something to find MID(A2,LEN(FUNCTIONHERE TO FIND BEGINNING NUMERIC), LEN(FUNCTIONHERE TO FIND SPACE OR "REV" AND SEGREGATE AFTER SUCH).
Okay, I don't know if there might be more spaces in the company name, but for the sample you provided, the below formulae work:
=IF(ISERROR(FIND("-",LEFT(A2,FIND(" ",A2,9)))),LEFT(A2,FIND(" ",A2,9)),LEFT(A2,FIND(" ",A2,8)))
=IF(ISERROR(FIND("-",LEFT(A2,FIND(" ",A2,9)))),MID(A2,FIND(" ",A2,9)+1,FIND(" Rev.",A2)-FIND(" ",A2,9)-1),MID(A2,FIND(" ",A2,8)+1,FIND(" Rev.",A2)-FIND(" ",A2,8)-1))
It's a bit long though ^^;
It will work for Company Two. Since T is the 9th index in the string, the default formula will look for the next space, which is inside the revision, and also grab a -, which I'm using in the condition. If there is a -, it means that there is a single space in the company name, and thus, reset the search for space from the 8th index.
And MID just works on the same principle, with +1 and -1 to remove the extra spaces.
Note: It won't work if there are more than two spaces in the company name, e.g. Company the first or names having spaces after the 9th character e.g. Companies Twenty.
This may be much easier with the help of even Word's (primitive) regex. Load into Word, Replace All with Use wildcards ticked: first ( [0-9]) with ^t\1 then (- ) with \1^t and load back into Excel. (Copes with the otherwise tricky issue of the number of spaces in a company name).

Resources