How to Use INDEX MATCH with Multiple Criteria for Date Range

Let’s say we have certain products whose prices have remained stable for a certain period of time. We want to INDEX MATCH the prices for the given criteria.

dataset-Index Match Multiple Criteria Date Range


How to Use INDEX MATCH with Multiple Criteria for Date Range: 3 Easy Ways

Method 1 – Using INDEX MATCH Functions for Multiple Criteria of Date Range

Suppose we want to see the price of an Ice Cream on 02-10-22 (month-day-year). If the given date falls between the offered period of time, we’ll have the price extracted in any blank cell.

Steps:

  • Insert the following formula in the result cell (i.e., I5). As the formula in an array formula, Press Ctrl + Shift + Enter to apply it.
=INDEX($E$5:$E$16,MATCH(1,(($B$5:$B$16=G5)*($D$5:$D$16>=H5)*($C$5:$C$16<=H5)),0))

index match-Index Match Multiple Criteria Date Range

The formula returns the price of the Produce if the listed date falls in the given period of time (i.e., Date range) as depicted below.

Formula Breakdown:

Excel INDEX function finds a value of a given location within a given range. In our case, we use the MATCH function induced with the INDEX function. The MATCH function passes its result as a row number for entries that satisfy given criteria. The syntax of an INDEX function is

INDEX(array, row_num, [col_num])

In the formula, $E$5$E$16 refers to the array argument. Inside the MATCH function $B$5:$B$16=G5, $D$5:$D$16>=H5, and  $C$5:$C$16<=H5 declare the criteria. To provide better identification, we color respective ranges in rectangles.

identification in rectangles

The MATCH function locates the position of a given value within a row, column, or table. As mentioned earlier, the MATCH portion passes the row number for the INDEX function. The syntax of the MATCH function is:

MATCH (lookup_value, lookup_array, [match_type])

The MATCH portion is:

=MATCH(1,(($B$5:$B$16=G5)*($D$5:$D$16>=H5)*($C$5:$C$16<=H5)),0)

The MATCH portion assigns 1 as lookup_value, ($B$5:$B$16=G5)*($D$5:$D$16>=H5)*($C$5:$C$16<=H5) as lookup_array, and 0 declares the [match_type] as an exact match.

The used MATCH formula returns 3 as it finds Ice Cream in row number 3.

identification

In case we have multiple products to extract their price from the dataset, you can drag the formula down to autofill the cells.

index match function result


Method 2 – XLOOKUP Function to Deal with Multiple Criteria

The XLOOKUP function is only available in Excel 365. The syntax of the XLOOKUP function is:

XLOOKUP (lookup, lookup_array, return_array, [not_found], [match_mode], [search_mode])

Steps:

  • Use the below formula in cell I5 and hit Enter.
=XLOOKUP(1,(H5>=$C$5:$C$16)*(H5<=$D$5:$D$16)*($B$5:$B$16=G5),$E$5:$E$16,"NotFound")

The XLOOKUP formula returns the respective price of the product that satisfies the given criteria (i.e., Product and Date).

xlookup function-Index Match Multiple Criteria Date Range

Formula Breakdown:

The XLOOKUP assigns 1 as its lookup argument, (H5>=$C$5:$C$16)*(H5<=$D$5:$D$16)*($B$5:$B$16=G5) as lookup_array, $E$5:$E$16 as return_array. Also, the formula displays Not Found text in case entries don’t fall in the date range. We indicated the assigned criteria in colored rectangles as depicted in the following image.

identification

The formula displays Not Found if the given date criteria don’t expand within the given date range.

xlookup final result


Method 3 – Use INDEX and AGGREGATE Functions to Extract a Volatile Price from Date Range

Some Products prices (i.e., crude oil, currency, etc.) are so volatile that they fluctuate each week or even day. We have the prices of a certain product in a week’s interval and want to find the price for the given dates.

Steps: Type the following formula in the result cell (i.e., E8) and hit Enter.

=IFERROR(INDEX(C$5:C$13,AGGREGATE(15,6, ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5))-ROW(B$5)+1,ROWS(E$8:E8))),"")

index aggregate function-Index Match Multiple Criteria Date Range

The 1st price of the product dated 02-15-22 to 02-25-22 is $0.84. There may be more hits in the table depending on the date range, but this function will fetch the first recorded instance, if any exist.

Formula Breakdown:

The syntax of the AGGREGATE function is

AGGREGATE (function_num, options, ref1, ref2)

In the formula, =IFERROR(INDEX(C$5:C$13,AGGREGATE(15,6, ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5))-ROW(B$5)+1,ROWS(E$8:E8))),"");

AGGREGATE(15,6,ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5))-ROW(B$5)+1,ROWS(E$8:E8))) portion provides the row number to the INDEX function. C$5:C$13 is the array argument of the INDEX function.

Inside the AGGREGATE formula,

(B$5:B$13>=F$4)*(B$5:B$13<=F$5) returns 1 or 0 depending on whether the dataset dates fall in the range or not.

ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5)) returns an array of row numbers depending on the satisfying the date criteria. Otherwise, results in error values.

ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5))-ROW(B$5)+1 as ref1 results in an array of row numbers converted into index numbers otherwise in error values.

ROWS(E$8:E8) as ref2 results in row number and it’s an easy way to get row number as you apply the formula downward.

The number 15=function_num (i.e., SMALL), 6=options (i.e., ignore error values). You can choose function_num from 19 different functions and Options from 8 different options.

At last, AGGREGATE(15,6,ROW(B$5:B$13)/((B$5:B$13>=F$4)*(B$5:B$13<=F$5))-ROW(B$5)+1,ROWS(E$8:E8))) passes the nth smallest index number of a row that satisfies the given criteria.

In case any error occurs, IFERROR(INDEX...),"") ignores all types of errors and transforms them into blanks.

identification

  • Drag the Fill Handle to fetch other matched prices within the criteria date range. The IFERROR function results in blank cells if the formula encounters any errors.

index aggregate final result


Download Excel Workbook

Multiple Criteria Date Range.xlsx

<< Go Back to Multiple Criteria | INDEX MATCH | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!

Tags: Excel Index Match Multiple Criteria

Maruf Islam
Maruf Islam

MARUF ISLAM is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he creates techy content... Read Full Bio

6 Comments
  1. Reply
    Jorge Oct 5, 2022 at 12:04 AM

    Hello, I downloaded the multiple criteria data range workbook and it works great until I click a cell with the price then click the formula and back into the price cell, I get N/A for the price result.
    Not sure if my Excel pushing the formula out of the date range.
    I have Office 2021 Home and Business version Excel.

  2. Reply Avatar photo
    Durjoy Paul Oct 10, 2022 at 10:45 AM

    Hello Jorge,
    This is an array formula. It must be completed by pressing Ctrl+Shift+Enter. Otherwise, it won’t work. For a normal formula, we press only Enter. But for an array, you have to press Ctrl+Shift+Enter. I hope you get your solution. If you find any more problems, feel free to ask in the comment box. We are always here to help you.

  3. Reply
    Frank Nov 16, 2022 at 7:40 AM

    What if in the first table you have 2 “ice cream” rows with two different dates. If you want to extract lets say the date that is closest to the Criteria 2, how could you do this? I tried your formula but it doesn’t work as intended. It just brings the same price

    • Reply Avatar photo
      Guria Nov 20, 2022 at 11:15 AM

      Hello Frank,
      Thank you for sharing your query. I am replying to you on behalf of ExcelDemy. According to your question, I assume the dataset will look like this where the product “Ice Cream” is in two rows with different dates and prices.

      Now, to solve your problem, you have to put a date in Criteria 2 that lies in between the dates you want a price from. Afterward, apply the same formula as we used earlier and it will show the accurate price.
      =INDEX($E$5:$E$16,MATCH(1,(($B$5:$B$16=G5)*($D$5:$D$16>=H5)*($C$5:$C$16<=H5)),0))

      I hope this solution will help you. Let us know your feedback.
      Thanks!

  4. Reply
    KLC Feb 24, 2023 at 10:27 AM

    I really found your walkthrough enlightening, but I couldn’t get it to work for my needs. I’m trying to take data in this format
    https://i.imgur.com/Fi2Ezfn.png

    and extract it to this format
    https://i.imgur.com/KivASn6.png

    At this point it’s going to be faster to do it manually, but would really like to learn how to do something like this. I tried your xarray formula where I used an offset command to build the range for the final lookup manually, but i couldn’t get it to work

    • Reply Avatar photo
      Eshrak Kader Feb 27, 2023 at 2:49 PM

      Hello KLC,
      Thank you for your feedback. Unfortunately, we’re having trouble accessing the pictures in the link, so you can attach your Excel workbook and send it to us at [email protected].
      Error when accessing link
      Regards,
      ExcelDemy

Leave a reply Cancel reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo

PHP网站源码伊春SEO按天计费公司中山网站推广系统多少钱宝安seo优化多少钱蚌埠网站推广工具报价景德镇关键词按天收费多少钱襄阳网站开发哪家好喀什关键词按天计费本溪网络推广公司黄南网站优化软件价格珠海百度爱采购报价湘潭推广网站曲靖网站推广系统推荐天门SEO按天扣费推荐和县网站改版桐城网站优化推广价格木棉湾网站优化排名报价通化SEO按效果付费价格兴安盟网站推广哪家好恩施如何制作网站报价黄南SEO按效果付费推荐沧州建网站价格汉中seo网站优化推荐鄂州SEO按天扣费公司横岗设计公司网站价格宿州SEO按效果付费哪家好横岗seo优化推荐凉山百度网站优化哪家好菏泽网站搭建报价迁安网站建设报价黔东南企业网站改版歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

PHP网站源码 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化