+ Reply to Thread
Results 1 to 20 of 20

Looking for a MAX date based on variable row number

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Looking for a MAX date based on variable row number

    Good afternoon, I have looked thru multiple forums but have not found what I am trying to do. Any help is appreciated. I have an Excel sheet with locations in the first column and multiple truck delivery dates per location off to the right, What I am trying to do is look for the latest delivery date prior to a specific date for a specific location. MAX formula works great to find the date but I'm having trouble finding based on location number lookup. In the example below, I'm looking for the latest date prior to 7/20/2020 for location 110. Correct date is 7/8/2020. Location and dates will vary so I need a formula that can reference 2 cells for looking up location (110) and process date (7/20/2020)

    105 6/17/2020 6/26/2020 7/15/2020 7/29/2020 8/14/2020 8/28/2020
    106 6/17/2020 6/26/2020 7/15/2020 7/29/2020 8/14/2020 8/28/2020
    110 6/9/2020 6/23/2020 7/8/2020 7/22/2020 8/6/2020 8/20/2020

    MAX formula that I'm using
    =MAX(IF('2020 Schedule'!$D$3:$AA$3<C1,'2020 Schedule'!$D$3:$AA$3))

    C1 is the location number I'm looking up and in this case row 3 has all the dates for location 110. This works great as long as I can manually point to row 3 but each week I have hundreds that need looking up.

    Where I'm stuck is how do I fold in a lookup or Index/Match etc. to look down for the location number then across for my max date.

    Thanks in advance for your assistance.
    Attached Files Attached Files
    Last edited by kenhunter; 06-11-2020 at 09:19 AM.

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Looking for a MAX date based on variable row number

    Hi,
    Can you upload your matrix to excel?
    Look at the yellow banner at the top of the page.

  3. #3
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Thank you Belinda200, I'm new here. Appreciate the guidance.

  4. #4
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Looking for a MAX date based on variable row number

    I'm copying here the guidelines:
    "Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen."

  5. #5
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    I added the spreadsheet to my post, is there something I should have done in addition?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,071

    Re: Looking for a MAX date based on variable row number

    How about
    =AGGREGATE(14,6,B1:U13/(A1:A13=A17),1)

    Where A17 has the location of interest.

  7. #7
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Looking for a MAX date based on variable row number

    F16 =index($B$1:$U$13,match(D16,$A$1:$A$13,0),small(if((lookup(E16,B1:U13))=$B$1:$B$13,column($B$1:$B$13)),1)-1)

    This is an array formula, meaning -
    To work correctly, it needs to be entered with control + shift + enter. When you enter a formula this way, you'll see the formula...
    Attached Files Attached Files
    Last edited by Limor_OP; 06-11-2020 at 10:10 AM.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,071

    Re: Looking for a MAX date based on variable row number

    Missed the before certain date part.
    =AGGREGATE(14,6,B1:U13/((A1:A13=A17)*(B1:U13<A18)),1)

    Location in A17 & Date in A18

  9. #9
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Looking for a MAX date based on variable row number

    Message delete by user

  10. #10
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Thanks Fluff13, this shows me the MAX date in the set for the location but I need also the ability to supply specified date that the result needs to be prior to. In the above example location 110, I looking for the MAX date prior to 7/20/2020. Result being 7/8/2020.

  11. #11
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Fluff13, just saw your update, let me try that. :-)

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,071

    Re: Looking for a MAX date based on variable row number

    Yeah, I missed that originally & so reposted in post#8

  13. #13
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Fluff13, that works PERFECTLY!! Thank you so much for your help I greatly appreciate it!

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,071

    Re: Looking for a MAX date based on variable row number

    You're welcome & thanks for the feedback.

    Did you try belinda200's formula as well?

  15. #15
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Looking for a MAX date based on variable row number

    Mine is wrong.....now I realize.
    Nice solution Fluff13, easy and short

  16. #16
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Hi Belinda200, not sure why I didn't see your suggestion earlier but wanted to thank you. I knew there had to be someway to pair up lookup & Index/match. Thank you again for your help!

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,626

    Re: Looking for a MAX date based on variable row number

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  18. #18
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Looking for a MAX date based on variable row number

    Alternative solution;
    Please Login or Register  to view this content.
    Quang PT

  19. #19
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Thanks for your solution

  20. #20
    Registered User
    Join Date
    08-28-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Looking for a MAX date based on variable row number

    Thanks for your guidance, have a great day.

+ 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. auto-populate a date based on date began and other variable
    By rcm4486 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-17-2017, 10:05 AM
  2. auto-populate a date based on date began and other variable
    By rcm4486 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2017, 07:58 AM
  3. [SOLVED] Assign number to each date and venue variable
    By maym in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2017, 08:55 PM
  4. [SOLVED] Copy multiple columns x number of times based on variable number?
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2017, 04:13 PM
  5. Copy column variable number of times between start date and end date
    By gbisk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 07:57 AM
  6. Replies: 2
    Last Post: 07-24-2012, 11:47 AM
  7. [SOLVED] Chart based on variable number of columns
    By Scott Hamilton in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-05-2005, 09:40 PM

Tags for this Thread

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