+ Reply to Thread
Results 1 to 17 of 17

Index & Match Formula with 2 Criteria inc. Nearest Date

  1. #1
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Question Index & Match Formula with 2 Criteria inc. Nearest Date

    Dear All,
    I have a question about index & match formula.
    I want to know about the quantity based on 2 criteria.
    First, one is based on OTW status and the second is based on the nearest date.
    Can you all help me to complete/correct the formula I'm using?
    For detail, please see attached file.
    thank you.
    Sample Index Match.xlsx
    Last edited by AliGW; 11-08-2022 at 03:18 AM. Reason: Thread title improved - please make your thread titles explicit & not generic in future.

  2. #2
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Index & Match Formula

    I'm not sure about 'nearest' meaning.

    If today is 8 Nov 2022 and the record date are
    9 Nov 2022 and 7 Nov 2022 which one to be selected ?

    And why not include all data in the same date?

    Regards.
    Attached Images Attached Images

  3. #3
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula.

    'nearest' means the closest date of arrival next from today.
    If today is Nov 8, then the nearest entry date is Nov 10, etc.
    And about the data, this is based on the incoming schedule.
    Sometimes in 1 shipment there are 1 or 2 shipments, and the shipping numbers are different from each other.
    So, that's why the data is like that.
    thank you.

  4. #4
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Index & Match Formula

    If you're insist not to include all of shipment in the same day.
    Please try this array formula

    =INDEX($B$4:$J$12,MATCH($B17,$B$4:$B$12,0),
    AGGREGATE(15,6,(COLUMN($B$3:$J$3)-COLUMN($A$3))/(1/((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14)*
    ($B$3:$J$3=MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3))))),1))

    Regards.

    Note :
    1 you need to unmerge part number and part name.
    2 for O365 user , I think there are another better solutions.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by menem; 11-08-2022 at 02:47 AM. Reason: Add note and file

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,002

    Re: Index & Match Formula

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. As you are new here, I have done it for you this time.)
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    One way (of many):

    =LET(eta,$F$3:$J$3,d,SORTBY(eta,eta),r,SORTBY(F5:J5,eta),INDEX(r,MATCH(1,(d>=TODAY())*(r>0),0)))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  7. #7
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Wow great,
    Thank you so much Menem & Glenn, that's very helpful.
    But I have another question, what if I want to know about no shipping for each item.
    I have tried with the same formula, but the results are not the same as the intended quantity.

  8. #8
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    summary all shipment of the day
    =SUMIFS(OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4)),$B$4:$J$4,$C$14,$B$3:$J$3,MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3)))

    count shipments of the day
    =COUNTIFS(OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4)),">0",$B$4:$J$4,$C$14,$B$3:$J$3,MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3)))

    Regards.
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    or:

    =LET(eta,$F$3:$J$3,d,SORTBY(eta,eta),q,F5:J5,r,SORTBY(q,eta),dv,MATCH(1,(d>=TODAY())*(r>0),0),CHOOSE({1,2},INDEX(r,dv),COUNTIFS(eta,INDEX(eta,dv),q,">0")))
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Sorry for the misunderstanding, I mean the shipping number of each item like the picture below.
    Attachment 804127

    Sorry because my English is not very good.

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Selecting Attachment 804127 results in the following message: "Invalid Attachment specified. If you followed a valid link, please notify the administrator".
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  12. #12
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Sorry for the attachment.
    please see picture below.
    sample.png

  13. #13
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    You may change the original formula from

    =INDEX($B$4:$J$12,MATCH($B17,$B$4:$B$12,0),
    AGGREGATE(15,6,(COLUMN($B$3:$J$3)-COLUMN($A$3))/(1/((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14)*
    ($B$3:$J$3=MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3))))),1))

    for incoming date
    =INDEX($B$3:$J$3,1,
    AGGREGATE(15,6,(COLUMN($B$3:$J$3)-COLUMN($A$3))/(1/((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14)*
    ($B$3:$J$3=MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3))))),1))

    for shipment number
    =INDEX($B$2:$J$2,1,
    AGGREGATE(15,6,(COLUMN($B$3:$J$3)-COLUMN($A$3))/(1/((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14)*
    ($B$3:$J$3=MIN(IF((OFFSET($B$4,MATCH($B17,$B$4:$B$12,0)-1,0,1,COLUMNS($B$4:$J$4))>0)*($B$4:$J$4=$C$14),$B$3:$J$3))))),1))

    Regards.

  14. #14
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Dear menem.
    it's work.
    thank you so much for your help.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    Since you have O365, you should take advantage of its strength and avoid volatile functions (like OFFSET) that recalculate every time anything changes. This can cause performance issues.

    One formula does everything:

    =LET(s,$E$2:$J$2,e,$E$3:$J$3,r,E5:J5,sS,SORTBY(s,e,1),eS,SORTBY(e,e,1),rs,SORTBY(r,e,1),d,MATCH(1,(eS>=TODAY())*(rs>0),0),nd,INDEX(eS,,d),CHOOSE({1,2,3,4,5},INDEX(rs,d),SUMIFS(r,e,nd),COUNTIFS(e,nd,r,">0"),nd,INDEX(sS,d)))
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    11-07-2022
    Location
    Bekasi, Indonesia
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    great,
    It is very helpful in solving problems in different ways.
    Thank you very much, Glenn.

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Index & Match Formula with 2 Criteria inc. Nearest Date

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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. Replies: 3
    Last Post: 09-05-2021, 05:33 AM
  2. [SOLVED] index/match funktion to find nearest value (date) from 2 data sources
    By dan_web in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 07-02-2021, 07:52 AM
  3. [SOLVED] Find nearest date in excel Index Match for two column
    By hkbhansali in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-29-2019, 05:43 AM
  4. [SOLVED] Index Match Formula with date and code as criteria
    By bubuweas in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-11-2019, 07:40 AM
  5. [SOLVED] INDEX/MATCH generates incorrect result by referencng nearest cell if match not found
    By aglawrence in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2017, 08:59 AM
  6. Index Match with Multiple Criteria One to Nearest Date
    By burningeagle in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-16-2014, 11:59 AM
  7. [SOLVED] Index match formula to search for two criteria (date & name)
    By davechamp1983 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-17-2012, 10:00 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