+ Reply to Thread
Results 1 to 9 of 9

Reading dates for highest/lowest temperatures

  1. #1
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Reading dates for highest/lowest temperatures

    I have a spreadsheet recording data from my weather station.
    Column headings are Date, Wind (mph), Dewpoint, Outdoor temp ......etc. etc
    I have been able to read lowest temperature in a month using LARGE and SMALL (eg =LARGE(J3:J4034,1)), but how can I find the date from the Date column where this highest temperature occurred. And what happens if the highest temperature occurred more than once on two or three different dates?
    I have been trying to work out VLOOKUP and HLOOKUP but have not been able to do what I want.
    I hope my explanation is clear. In the end I just I want to be able to derive a statement such as the "the lowest temperature in Feb was -7.8ºC on Feb 2nd.
    Last edited by CMG1; 03-16-2009 at 03:56 AM. Reason: Solution has been provided - thanks

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Reading dates for highest/lowest temperatures

    You actually asked the question we'll need answered:
    What happens if the highest temperature occurred more than once...?

    So...since it's your workbook....What do you WANT to happen?
    First occurrence of the highest temp?
    Last occurrence of the highest temp?
    Something else?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Reading dates for highest/lowest temperatures

    Hi Ron:
    In an ideal world it would be nice to record ALL occurrences of a max or min reading, but otherwise the first occurrence would be my choice.
    Thanks.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Reading dates for highest/lowest temperatures

    I attached a workbook with a mock-up.
    (I hope it works on your Mac)

    With
    Col_A containing dates...in A2:A50
    Col_A containing temps...in B2:B50

    Then....
    Max Temp
    D2: =MAX($B$2:$B$50)

    Instance_1 of the Max Temp (regular formula)

    Please Login or Register  to view this content.
    OR...You can use this shorter ARRAY FORMULA, but you must remember to use CTRL+SHIFT+ENTER (instead of just ENTER) when committing it
    Please Login or Register  to view this content.

    Either way, for subsequent instance dates....copy that formula across Row_2

    Is that something you can work with?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Reading dates for highest/lowest temperatures

    Ron: I am staggered and amazed. It is certainly giving me exactly the results I have been striving for. But now I am going to spend a bit of time seeing exactly what is going on before I mark this thread as solved.
    I am not familiar with the different technique of using CTRL+SHIFT+ENTER with an ARRAY FORMULA, and I can't find reference to it in the Mac Excel Help so this may be a PC only feature. However, using the longer version works well so I am a happy bunny!
    Let me try to get my head round it and I'll come back to you.
    Incidentally, my son says haven't you got anything better to do on a Sunday afternoon!
    Thanks, Chris

  6. #6
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Reading dates for highest/lowest temperatures

    Could you explain to me in plain English what is happening here.
    1. What is the Logical Test part of the IF statement asking?
    2. How is the Value If True segment constructed?

    I have edited it to tell me highs/lows for a number of different categories - works perfectly.

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Reading dates for highest/lowest temperatures

    Re:
    Please Login or Register  to view this content.

    Since we are copying the formula across to the right from E2
    we want to know when to stop finding dates and start displaying
    text blanks ("").
    • This part:
    Please Login or Register  to view this content.
    calculates the count of values that match the MAX TEMP

    • This part:
    Please Login or Register  to view this content.
    Counts the columns referenced.
    When copied across..it returns:
    1 for COLUMNS($E:E)
    2 for COLUMNS($E:F)
    etc

    So this combination determines when the count of MAX TEMP days
    has been reached:

    Please Login or Register  to view this content.

    For the "VALUE IF TRUE" calculation...
    The ROW NUMBER for each referenced cell is
    multiplied by 1 (if the cell equals the MAX TEMP)
    or by 0 if it does not.
    The result is an array of 0's interspersed with row numbers.

    Please Login or Register  to view this content.

    The SMALL function looks in that array for the nTH smallest value
    after the count of 0's (which is the count of cells that DO NOT
    equal the MAX TEMP):
    Please Login or Register  to view this content.
    So, if there are 3 MAX TEMP days out of 49 cells,
    this combination finds the 47 smallest value
    (46 non-matches + the row of the first match):
    Please Login or Register  to view this content.
    That value is the row of the matched value.
    The INDEX function that wraps around the first part
    of the SMALL function eliminates the need for CTRL+SHIFT+ENTER.

    Finally, the outer INDEX function returns the date associated
    with the calculated row.

    I hope that helps.

  8. #8
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Reading dates for highest/lowest temperatures

    Thank you for going at my speed on this one - I appreciate the time you took to open it up.
    And I now have a wonderful fully-working solution. Thanks again.

    Chris

  9. #9
    Registered User
    Join Date
    03-15-2009
    Location
    Somerset, England
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Reading dates for highest/lowest temperatures

    Some months ago, Ron helped me with a formula to help with analysing the readings from my weather station.
    An example cell entry looks like this...

    =IF(COUNTIF($E$3:$E$4466,MAX($E$3:$E$4466))>=COLUMNS($E:E),
    INDEX($B:$B,SMALL(INDEX(($E$3:$E$4466=MAX($E$3:$E$4466))*ROW($E$3:$E$4466),0),
    COLUMNS($E:E)+COUNTIF($E$3:$E$4466,"<>"&MAX($E$3:$E$4466)))),"")

    This works great, but every month the total number of readings varies because of the number of days (Feb has 28 etc) so I have to change the $E$4466 value in the above manually for every occurrence of the cell.

    Is there an alternative way of looking at the values in the range "from $E$3 to the last (bottom) cell in column E that is not empty". I could then substitute this in the formula above and it would be good-to-go for any month, no matter how many rows there were?

    Thanks, Chris

+ 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