Index match including a date range with one criteria. For Excel.

aygreyson

New Member
Joined
Jun 1, 2022
Messages
6
Platform
  1. MacOS
I'm updating this question to an EXCEL FORMAT. I'm currently trying to pull data from the Workers column into a new sheet via Index Match, printing the workers' names each time they show up in a particular date range.

WorkersCompanyStart DateEnd Date
Jane SmithMicrosoft02/03/202203/31/2022
Mike RobertsGoogle03/01/202206/30/2022
Aaron SmithFacebook02/01/202204/30/2022
Fred BirchMicrosoft4/01/20224/30/2022

Currently, the equation I have is:

Index(Sheet1!A:A, match(if(Sheet1!C:C<=A2),if('Sheet1D:D>=B2),if('Sheet1!B:B=C2),True,False),False),False)),0),1)

But it seems to only be pulling the first name in the column and not the second name according to company and date range. Any sort of help pointing me in the right direction would be helpful. Thanks.

Start DateEnd DateCompanyWorkers
01/01/202201/31/2022Microsoft
02/01/202202/28/2022Microsoft
03/01/202203/31/2022Microsoft
04/01/202204/30/2022Microsoft
05/01/202205/31/2022Microsoft


***Edit*** I was unable to delete the original post.
 
You actually didn't need the explanation. I thought you were using Excel 2019, but it appears that you are using an online version with most (all?) of the Excel 365 features...so you can use the much simpler version I posted initially. But your dataset has issues. You have errors in the Active sheet beginning on row 158 and that causes the formula to fail. Those errors should be trapped to produce a blank. For now, I set the range of the arrays that are evaluated for rows 2:157 on the Active sheet, which doesn't quite cover the entire Active data table, but it allows the formula to work and obtain names from those rows on the Active sheet. Once the errors are fixed, the ranges in the formula can be expanded. Similarly, on the Dashboard sheet, there is something that prevents the formula from automatically copying down the entire length of the I column...I'm not sure why. I performed a manual copy/paste to populate the cells.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You actually didn't need the explanation. I thought you were using Excel 2019, but it appears that you are using an online version with most (all?) of the Excel 365 features...so you can use the much simpler version I posted initially. But your dataset has issues. You have errors in the Active sheet beginning on row 158 and that causes the formula to fail. Those errors should be trapped to produce a blank. For now, I set the range of the arrays that are evaluated for rows 2:157 on the Active sheet, which doesn't quite cover the entire Active data table, but it allows the formula to work and obtain names from those rows on the Active sheet. Once the errors are fixed, the ranges in the formula can be expanded. Similarly, on the Dashboard sheet, there is something that prevents the formula from automatically copying down the entire length of the I column...I'm not sure why. I performed a manual copy/paste to populate the cells.
I am using Excel 2019 but shared with Outlook for ease's sake, but I see you've updated the file. Many thanks, I'm now working on converting this back to Excel 2019.
 
Upvote 0
Well that will not work then and you will indeed need a different formula, such as the INDEX/AGGREGATE one I posted. But it will require using multiple columns to list out matching names before they can be consolidated into your desired target cell. Please examine the revised file you posted to confirm that the results are as expected. The Excel 365 version of the formula is in column O while the Excel 2019 formula is in helper columns P:T (assuming you will have no more than 5 names for any given row?). Then the names on any given row from the five helper columns are consolidated into a single cell in column U. If used on Excel 2019, you will need to leave the helper columns somewhere out of the way or hidden, and then bring the formula shown in column U into your main results table.

For the formulas that are producing errors on the Active sheet, those errors will also produce errors when these formulas attempt to examine those columns...so the errors need to be fixed or trapped. This is why I found it necessary to use a smaller range in the formulas I added, otherwise none of them would work. I believe most of them are caused by INDEX/MATCH functions that do not find any matches. The easiest remedy is to wrap the formula with an IFERROR. For example, instead of the 1st use the 2nd:
Excel Formula:
=INDEX(B5:B39736, MATCH(P5, C5:C39736, 0)
=IFERROR(INDEX(B5:B39736, MATCH(P5, C5:C39736, 0),"")
The blanks, instead of the error messages, should allow subsequent references to those cells to work okay. Once the errors are addressed, you can revise the formulas and extend the range to cover the full length of your data table.
Three things about your table:
1) Is the range shown in the formula example above really necessary? 39736 is very long...If you can specify a range that is long enough, but not too long, then I would try that. Once you do that, there should be no problem rounding that number up to an easier to remember--and easier to inspect--number. In this case, I would just use 40000 everywhere.
2) I see those INDEX/MATCH functions entered as array formulas. They should not need to be entered like that. Try editing the formula and simply entering it and copying it down the column to confirm that it works okay as a regular formula.
3) Those INDEX/MATCH functions are probably not going to provide the information you want because none of the ranges are "fixed" with $ signs. I suspect you want something like:
Excel Formula:
=IFERROR(INDEX($B$5:$B$39736, MATCH($P5, $C$5:$C$39736, 0),"")
...where the ranges used by INDEX and the MATCH lookup array are "fixed", while the lookup value ($P5 here) is the only value that changes. I found the web interface to this file very "clunky" to work with, and any changes I attempted had significant lag times, so I did not investigate this further, but on your regular version of the file, please have a look at all of the INDEX/MATCH functions, as I believe they are not constructed quite right.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top