+ Reply to Thread
Results 1 to 3 of 3

Inaccurate array formula

Hybrid View

  1. #1
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47

    Inaccurate array formula

    Hello,

    Referenced spreadsheet attached below.

    I have an Excel document which receives data dump from a weather website cells B1:I20.

    I need the temperature and dew point from cells B3:I3, however the data is returned in a "Temperature / Dew Point" format. To use the data, I separate the Temp and DP into their own cells B22:I23 by:
    Temp =LEFT(B3,FIND("/",B3)-1)
    DP =RIGHT(B3,FIND("/",B3)-2)
    I use to the data to figure the High, Average, and Low values for both variables in the following array in cells B25:G25:

    For Temp...
    High Temp =MAX(LEFT($B22:$I22&"0",2)*1)
    Avg Temp =AVERAGE(LEFT($B22:$I22&"0",2)*1)
    Low Temp =MIN(LEFT($B22:$I22&"0",2)*1)
    
    For DP...
    High DP =MAX(LEFT($B23:$I23&"0",2)*1)
    Avg DP =AVERAGE(LEFT($B23:$I23&"0",2)*1)
    Low DP =MIN(LEFT($B23:$I23&"0",2)*1)
    However, on occasion, the array will return an incorrect result, for example today it shows the High DP as being 90, but should only be 14.
    Any ideas of another way of doing this?

    Thanks!
    Attached Files Attached Files
    Last edited by asdvender; 12-12-2009 at 04:15 PM. Reason: Solved, thanks DonkeyOte!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inaccurate array formula

    change

    B22: =--LEFT(B3,FIND("/",B3)-1)
    copied across

    C22: =--RIGHT(B3,FIND("/",B3)-2)
    copied across

    the above simply converts your "string" outputs to numbers (eg --"10" -> 10)

    With the above in place you can then change your other formula to just basic MAX/AVERAGE/MIN formulae, eg:

    B25: =MAX(B22:I22)

    C25: =AVERAGE(B22:I22)

    D25: =MIN(B22:I22)

    repeat for DP..

    (on an aside your existing arrays fail on occasion because where the string is < 2 chars in length you're adding the "0" to the end of the string rather than to the beginning - eg "9" becomes "90" rather than "09")

  3. #3
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47

    Re: Inaccurate array formula

    Thanks, DonkeyOte! Worked like a charm, simplified it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1