+ Reply to Thread
Results 1 to 12 of 12

Max value between two dates, return the year that the max temp occurred.

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    28

    Max value between two dates, return the year that the max temp occurred.

    Temps.JPGTemps.xlsx

    In the image/spreadsheet, I am wanting to be able to return Jan.05 and 2012. Once I have the formula for one, I can manage the second.

    Thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Max value between two dates, return the year that the max temp occurred.

    post deleted, wrong comment
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Max value between two dates, return the year that the max temp occurred.

    Try this ARRAY formula...
    =INDEX($I$2:$I$32,MATCH(MAX(IF(Day_Weather>=Entry_Date,IF(Day_Weather<=Exit_Date,Temp_RecH))),Temp_RecH,0))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  4. #4
    Registered User
    Join Date
    12-09-2014
    Location
    Wicklow, Ireland
    MS-Off Ver
    Win 7
    Posts
    25

    Re: Max value between two dates, return the year that the max temp occurred.

    Temps AW 17-2-15.xlsx

    This should work. Let me know if you need help

    Adam

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Max value between two dates, return the year that the max temp occurred.

    =EDATE(MIN(IF(Day_Weather>=Entry_Date, IF(Day_Weather<=Exit_Date,IF(Temp_RecH=LEFT(B6,LEN(B6)-3)+0,Day_Weather)))),(MIN(IF(Day_Weather>=Entry_Date, IF(Day_Weather<=Exit_Date,IF(Temp_RecH=LEFT(B6,LEN(B6)-3)+0,$I$2:$I$32))))-YEAR(MIN(IF(Day_Weather>=Entry_Date, IF(Day_Weather<=Exit_Date,IF(Temp_RecH=LEFT(B6,LEN(B6)-3)+0,Day_Weather))))))*12)

    Try this array formula
    i think this is very long
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Max value between two dates, return the year that the max temp occurred.

    Hi Smit.

    I think your data might do well using a Pivot Table. I've constructed a bunch of fake data and done a Pivot with it. See if Pivots make your work easier. Time to learn Pivots?
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Max value between two dates, return the year that the max temp occurred.

    Not really sure in what format you would like it to be presented but here is my take on it

    array formula

    =INDEX(TEXT(D2:D32,"MMM-dd")&" "&I2:I32&" "&H2:H32&" ᵒF",MATCH(MAX(IF((D2:D32>=B1)*(D2:D32<=B2),H2:H32)),H2:H32,0))

    ***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER

    Row\Col
    A
    B
    1
    Entry Date
    2015/Jan/01
    2
    Exit Date
    2015/Jan/06
    3
    4
    5
    Jan-05 2012 42.8 ᵒF
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  8. #8
    Registered User
    Join Date
    02-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    28

    Re: Max value between two dates, return the year that the max temp occurred.

    Thank you everyone for your reply. I with a combo of FDibbins and AlKey.

    Thanks! Again!

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Max value between two dates, return the year that the max temp occurred.

    You're welcome and thank you for the feedback!

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Max value between two dates, return the year that the max temp occurred.

    Quote Originally Posted by AlKey View Post
    Not really sure in what format you would like it to be presented but here is my take on it

    array formula

    =INDEX(TEXT(D2:D32,"MMM-dd")&" "&I2:I32&" "&H2:H32&" ᵒF",MATCH(MAX(IF((D2:D32>=B1)*(D2:D32<=B2),H2:H32)),H2:H32,0))

    ***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER

    Row\Col
    A
    B
    1
    Entry Date
    2015/Jan/01
    2
    Exit Date
    2015/Jan/06
    3
    4
    5
    Jan-05 2012 42.8 ᵒF
    @ alkey
    Nice one but
    i think there is a flaw
    if the start date is 8 Jan 2015 and End Date is 9 Jan 2015 it will give 7 Jan 2015
    =INDEX(TEXT(D2:D32,"MMM-dd")&" "&I2:I32&" "&H2:H32&" ᵒF",MATCH(MAX(IF((D2:D32>=B1)*(D2:D32<=B2),H2:H32)),IF((D2:D32>=B1)*(D2:D32<=B2),H2:H32),0))

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Max value between two dates, return the year that the max temp occurred.

    Happy to help, thanks for the feedback

  12. #12
    Registered User
    Join Date
    02-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    28

    Re: Max value between two dates, return the year that the max temp occurred.

    Nice catch, AlKey. I updated it with your code.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculate Volume Per Day Based on How Many Days of Year Have Occurred
    By sulax in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2014, 10:55 AM
  2. [SOLVED] Trying to return the week number of dates in a fiscal year
    By NedFlanders in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-03-2013, 09:16 PM
  3. How do I return first year that expenditure occurred?
    By LinnyLoo in forum Excel General
    Replies: 4
    Last Post: 06-14-2012, 08:21 AM
  4. Help with Formulae to return a Month and Year only from a column of dates
    By rick.parry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2012, 08:52 AM
  5. 2 digit year in dates return 19xx not 20xx
    By moranbo in forum Excel General
    Replies: 1
    Last Post: 09-06-2005, 09:05 PM

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