Solved

Formula Revision

Posted on 2010-11-15
8
571 Views
Last Modified: 2012-05-10
Hello, I have a formula that extracts data from a line.  The formula is =MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+4,2). The data format has changed a bit.  See below

KDDD 091200Z 12010KT, current formual extracts 12
KDDD 091200Z 12010G18KT, need to extract 10
KDDD 091200Z COR 12010KT, need it to take in account and extra space and extract 10
KDDD 091200Z COR 12010G18KT, need to extract 10

0
Comment
Question by:sandramac
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 34140564
Is the 12 constant? If so try

=MID(A1,FIND("12",A1)+3,2)

regards, barry
0
 
LVL 13

Accepted Solution

by:
gbanik earned 250 total points
ID: 34140986
=MID(A1,FIND("|",SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+4,2)
0
 
LVL 13

Expert Comment

by:gbanik
ID: 34140999
Sample file for above code
Get10.xlsx
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 50

Expert Comment

by:barry houdini
ID: 34141054
.......mmm, yes, my suggestion won't work, will it, even if 12 is constant because 12 can (and does) occur earlier in the string, so disregard my suggestion above.

Here's another possibility which identifies the text after the last space (a little like gbanik's suggestion)

=MID(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)),4,2)

regards, barry
0
 

Author Comment

by:sandramac
ID: 34141058
The 12 is not constant that value will change
0
 
LVL 13

Expert Comment

by:gbanik
ID: 34141089
Have u tried my suggestion?
0
 

Author Comment

by:sandramac
ID: 34141091
Hello in the formula =MID(A1,FIND("|",SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+4,2) There will also be text after it for example KDDD 091200Z COR 12010G18KT 7SM BKN100,
0
 
LVL 50

Assisted Solution

by:barry houdini
barry houdini earned 250 total points
ID: 34141445
Both my suggestion and gbanik's will return the 4th and 5th characters after the last space.....so in tht example the result will still be "10".....but I assume that's co-incidental.

In order to provide a formula that works in all cases it's normally necessary to identify some rule or consistency - I can only guess what that might be unless you can provide a larger sample.

From the examples so far it looks like you always want either the 4th and 5th characters of the 3rd "word"....unless that "word" is not numeric (i.e. "COR" in your examples) in which case you need the 4th and 5th characters of the 4th "Word". Will that work for you? If so try this formula based on gbanik's suggestion

=MID(A1,FIND("|",SUBSTITUTE(A1," ","|",2+ISERR(MID(A1,FIND("|",SUBSTITUTE(A1," ","|",2))+1,1)+0)))+4,2)

regards, barry

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

690 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