+ Reply to Thread
Results 1 to 12 of 12

Index Match with multiple criteria including date range

  1. #1
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Index Match with multiple criteria including date range

    I am able to write a formula using Index Match but I need to now include a date range as part of the criteria that that captures the date of the promotion. Attached is an example of my correct formula, along with a section that includes date ranges. Any help would be appreciated!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Index Match with multiple criteria including date range

    First,

    H6 is wrong as it only filter the date instead of both criteria.
    you can try change the D in B6 to C.
    the result is C instead of error.

    it should be
    =INDEX(B4:B9,SUMPRODUCT((C4:C9=H4)*(ROW(B4:B9)-3)*(B4:B9=H3)))

    in H19
    =INDEX(B4:B9,SUMPRODUCT((C4:C9>=I16)*(C4:C9<=I17)*(ROW(B4:B9)-3)*(B4:B9=H14)))


    PS: it may not suitable as it ONLY function well when there have ONLY ONE RESULT that meet all criteria.
    Hope you can learn every time you visit here.

    If you still confuse on how it work, kindly ask or go to
    i) Formula - Formula (Ribbon) > Formula Auditing (Section) > Evaluate Formula > Evaluate; or
    ii) VBA/Code - Click F8 to see how it work step by step.

    It it take care of your question, Please:
    Mark tread as [Solved] [Thread Tools->Mark thread as Solved]
    ;and
    Click *Add Reputation to thank anyone solved your question.

  3. #3
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index Match with multiple criteria including date range

    Thank you for your reply. This formula worked, but I inadvertently miscommunicated one of the required criteria. I actually need to show if the the date of the promotion falls within a specific month then it uses a "date range" search for that month. For example, if I add a criteria of 11/1/18 it will search for the letter "D" that falls in that month. I hope that makes sense.

    I also need one more argument to avoid errors if there is not a match. I tried to include an iferror argument in your formula but it would not work.
    Here is what I added, that did not work. =iferror(INDEX(B4:B9,SUMPRODUCT((C4:C9>=I16)*(C4:C9<=I17)*(ROW(B4:B9)-3)*(B4:B9=H14))))

    By the way, I did not realize that the solution was a combination of Index and SumProduct, as I was thinking it was Index and Match. I was also thinking it would require an array formula given the required date range. I do have one additional question. Is there a way to modify the formula so if a row is added above the header (row 3) that the number will dynamically change from -3 to -4? I noticed if I add a row the result will be incorrect.

    By the way, my desired answer will always only be one option so this formula will meet the criteria, except if there is no result as mentioned above.
    Last edited by Perk1961; 07-11-2017 at 12:57 PM.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Index Match with multiple criteria including date range

    Perk,

    Try changing BW's formula to this.

    =INDEX(B4:B9,SUMPRODUCT((C4:C9=H4)*(ROW(B4:B9)-MIN(ROW(B4:B9))+1)*(B4:B9=H3)))

    Now insert the row(s). It still works at my end.
    Dave

  5. #5
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index Match with multiple criteria including date range

    Hi Dave. Excellent. That resolves the dynamic question I had as I can now add or remove rows above the header.

    Would you happen to know how to add the iferror argument to this formula? My attempt did not work. =IFERROR(INDEX($B$4:$B$9,SUMPRODUCT(($C$4:$C$9=$H$4)*(ROW($B$4:$B$9)-MIN(ROW($B$4:$B$9))+1)*($B$4:$B$9=$H$3))),0)

    Also, I am still trying to figure out how to modify the formula so the result searches a date range and returns a match based on a date that falls within that range. For example, if I add a criteria of 11/1/18 it will search for the letter "D" that date falls within a date range.

    Thanks in advance.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Index Match with multiple criteria including date range

    There is nothing "wrong" with the syntax of your IFERROR. The approach BW has used will return 0 in the SUMPRODUCT if no match is found.

    I would propose an alternative array formula.

    This version needs to be array entered (Ctrl + Shift + Enter)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you are interested this variation of same does not have to be committed CSE. By inserting an additional INDEX call:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index Match with multiple criteria including date range

    Brilliant! What is nice is I do not have to even use a date range as your formula accounts for this. Much appreciated for both the CSE and non CSE version!

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Index Match with multiple criteria including date range

    You are welcome. Thank you for the feedback and marking your thread SOLVED. It helps everyone.

  9. #9
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index Match with multiple criteria including date range

    I just noticed I need one more argument for this formula in order to match the desired result. The formula you have does a great job in matching the date with the month but I also need it to match the year. Is there a way to tweak the formula to include that? The reason I ask it because the result in my final file is only recognizing 2018, where my data includes some same exact data but in 2017.

    =IFERROR(INDEX($B$4:$B$9,MATCH(1,INDEX(1/((MONTH($H$4)=MONTH($C$4:$C$9))*($H$3=$B$4:$B$9)),0),0)),"No Promo")

    Thanks in advance.

  10. #10
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index Match with multiple criteria including date range

    Please disregard my last message as I figured it out. The new formula that takes month and year into consideration is

    =IFERROR(INDEX($B$4:$B$9,MATCH(1,INDEX(1/((MONTH($H$4)&YEAR(H4)=MONTH($C$4:$C$9)&YEAR($C$4:$C$9))*($H$3=$B$4:$B$9)),0),0)),"No Promo")

    Thanks!

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Index Match with multiple criteria including date range

    Good work.

  12. #12
    Forum Contributor
    Join Date
    03-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Index Match with multiple criteria including date range

    let me explain abit on this
    (ROW(B4:B9)-3)

    I use this is due to the
    =ROW(B4:B9)
    will return to
    ={4,5,6,7,8,9}

    it will not suitable for INDEX function,
    =index(,"Here",)
    as it start at 4,

    hence I minus 3 (ROW(B4:B9)-3) to get the result of
    ={1,2,3,4,5,6}

    hope it clarify.

+ 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. [SOLVED] Count and sum with multiple criteria including date range
    By Perk1961 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-23-2016, 04:46 PM
  2. Sumif or Index/Match on Multiple Criteria including Dates to Month?
    By patrick1024 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2015, 11:00 PM
  3. [SOLVED] INDEX MATCH based on 5 criteria, including a date range.
    By Folshot in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 09:35 PM
  4. [SOLVED] Index Match with date range criteria
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 10-24-2013, 04:58 PM
  5. [SOLVED] Using Index/Match using criteria including range between two cells
    By fer907 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2013, 04:07 PM
  6. [SOLVED] COUNTIF / SUMPRODUCT- multiple criteria - including date range
    By Sph01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-31-2012, 04:54 AM
  7. Replies: 5
    Last Post: 05-23-2011, 12:04 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