Solved

Formula Revision

Posted on 2010-11-15
8
563 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now