Solved

Extract Data

Posted on 2011-09-09
7
310 Views
Last Modified: 2012-05-12
Hello all, I am tyring to extract a weather observation.  I need to get the temperature for a weather reports.  The example below is in cell A1.  I need to get the value 23 into cell c34.  Some things that are constant in a weather observation it is always preceded by the first "/" there can be mulitple "/" but the temperature is always before the first "/"  also the value can be either two digits or a "M"followed by 2 digits, like M12, which is equal to minus 12.  How can i get a way to extract this data.

KICT 092253Z 02006KT 10SM TS BKN075CB OVC110 23/15 A3001
0
Comment
Question by:sandramac
  • 4
  • 2
7 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 36514404
Try the following formula:
=--SUBSTITUTE(RIGHT(LEFT(A1,FIND("/",A1)-1),3),"M","-")
0
 

Author Closing Comment

by:sandramac
ID: 36514418
Thank it works,
0
 
LVL 81

Expert Comment

by:byundt
ID: 36514435
With hindsight, I see that I can shorten the formula to:
=--SUBSTITUTE(MID(A1,FIND("/",A1)-3,3),"M","-")
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 18

Expert Comment

by:Curt Lindstrom
ID: 36514478
Brad, one digit positive temperatures will produce a #VALUE! error with your formula

KICT 092253Z 02006KT 10SM TS BKN075CB OVC110 3/15 A3001

Curt
0
 
LVL 81

Expert Comment

by:byundt
ID: 36514610
Curt,
I assumed temperatures between -9 and +9 would be written as M09 or 09 with a leading 0. If that should not be the case, then the following will work:
=--SUBSTITUTE(MID(SUBSTITUTE(A1," ","  "),FIND("/",SUBSTITUTE(A1," ","  "))-3,3),"M","-")
It substitutes two spaces for every one in the original text.

Brad
0
 
LVL 18

Expert Comment

by:Curt Lindstrom
ID: 36514657
Brad,
I was thinking:

=IF(ISERR(--SUBSTITUTE(MID(A1,FIND("/",A1)-3,3),"M","-")),--SUBSTITUTE(MID(A1,FIND("/",A1)-2,2),"M","-"),--SUBSTITUTE(MID(A1,FIND("/",A1)-3,3),"M","-"))

..but as always you find the most efficient formula to solve a problem :-)

Cheers,
Curt

0
 
LVL 81

Expert Comment

by:byundt
ID: 36514733
Curt,
In Excel 2007 or later, your approach might become:
=IFERROR(--SUBSTITUTE(MID(A1,FIND("/",A1)-3,3),"M","-"),--MID(A1,FIND("/",A1)-1,1))

Brad
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

830 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