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
Solved

Formula Revision

Posted on 2010-11-15
8
566 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
  • 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
question about excel functionality 3 32
save excel in the same active file's folder. 8 20
List Box Entries Excel 2010 5 29
Cost allcocation ... 10 22
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 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