Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Formula Revision

Posted on 2010-11-15
8
Medium Priority
?
575 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 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

647 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