?
Solved

Parsing Data - Excel 2007

Posted on 2014-03-19
13
Medium Priority
?
190 Views
Last Modified: 2014-03-20
Hi - I have data that looks like the attached that I would like to parse into 3 fields as shown on the first line.  Can someone give me guidance on how to best accomplish this?  Thanks.
STAT.JPG
0
Comment
Question by:tomfarrar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
13 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 2000 total points
ID: 39940328
column B
=LEFT(A1,FIND("|",SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-1))-1)

column D:
=TRIM(RIGHT(A23,4))

Column C:
=TRIM(SUBSTITUTE(SUBSTITUTE(A1,D1,""),B1,""))
0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 39940355
As some of your data has more than 1 word for the first field it's not going to be easy
Would the text for the first field ever have more than 2 words (i.e.  Like Cretin Derham Hall)
0
 
LVL 7

Author Comment

by:tomfarrar
ID: 39940387
My apology, I was not clear.  The data in Column A looks like this for the first record:
 
"Cretin-Derham Hall OL 6-8" (without the quotations).  There is no "|".  The data would need to look like this for Columns B,C and D after parsing:

Col B - Cretin-Derham Hall
Col C - OL
Col D - 6-8

Thanks.  - Tom
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Author Comment

by:tomfarrar
ID: 39940392
Actually, yes, the first column could have more than words.  I depends on the name of the school.
0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 39940434
You need a bunch of hidden columns
1 - Length of full expression
2 - Position of 1st Space
3 - Position of 2nd space
4 - Position of 3rd space
.
.
6 - Count of total spaces

As the last 2 fields are always a single word (no Spaces)  then once you find the last valid space position - then that number +1 is the position of the last field. then go back one and the second last valid space+1 is the start of the second field and that second last space position is the Length - that number which you can calculate a =left(a1,xxx)
0
 
LVL 39

Expert Comment

by:nutsch
ID: 39940466
Have you actually tried my formulas? There's no | in your text, but there's one after I substitute it for the penultimate space in your data.

Applied to Cretin-Derham Hall OL 6-8, I get:

Cretin-Derham Hall      
OL      
6-8
0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 39940588
nutch - I tried your formulas and they only worked for the first field (column B)
The second filed ended up as the 2nd and 3rd field and the last field (D) was blank - It is pointing to A23 (What's that all about?)
0
 
LVL 7

Author Comment

by:tomfarrar
ID: 39940590
I tried your formula, nutsch, but let me try it again.  Be back shortly.
0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 39940599
Nutch

d  should be =TRIM(RIGHT(A1,4))  However - if the length of the last field is > 3 then is bombs again (Not that their are people that are 10 ft in Height :)
0
 
LVL 39

Expert Comment

by:nutsch
ID: 39940615
Indeed DTH, I had started on the 23rd row before adjusting, and indeed again, This doesn't take into account people taller than 10 ft or shorter than 1 foot. I'll take my chances.

Thomas
0
 
LVL 7

Author Comment

by:tomfarrar
ID: 39940635
You are so correct, nutsch.  Your formula does work if I create the formulas in the order you showed them (Col B, D and then C) and also replace TRIM(RIGHT(A23,4)) with TRIM(RIGHT(A1,4)).  Thank you.
0
 
LVL 7

Author Closing Comment

by:tomfarrar
ID: 39941714
Thanks again!  Your solution worked perfectly.  I am studying the formula to better understand how it accomplished the task.
0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 39942058
Nutsch - Nice formula - I too would be interested in how it determines the correct number of word in the first parsed record
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question