INDEX MATCH, but I need it to pull multiple results

Zanith

New Member
Joined
Feb 12, 2013
Messages
21
Hi all,

I'm running into an issue with some lookup I'm doing using INDEX MATCH which are stopping after they find the first result. I need this function to continue searching through the data for ALL possible matches to give me the result I need. I understand that an array formula is probably what I need, but I'm not certain and the work I've done so far to put one together has not worked properly.

The formula I'm using is as follows, and below is a rough idea of my table layout.

=IF(AND(INDEX('Cost Pool Account Set Line'!$B:$B,MATCH(Summary!C$1,'Cost Pool Account Set Line'!$D:$D,0))>=Summary!$A452,INDEX('Cost Pool Account Set Line'!$C:$C,MATCH(Summary!C$1,'Cost Pool Account Set Line'!$D:$D,0))<=Summary!$A452),"X","")

Summary = my "working" sheet which is summarizing the information.

Cost Pool Account Set Line = Table pulled in from power query on a separate sheet within the workbook


Summary Sheet Layout - I need the formula to identify that there are entries in the Cost Pool Account Set Line for LABOR not just for the 10000 (which it's doing now), but also 11000 and 11010.

NumberLABORFRINGE
10000X
10100X
11000X
11010X

<tbody>
</tbody>


Cost Pool Account Set Line

From AccountTo AccountCost Pool Account Set Name
1000010099LABOR
1010010100FRINGE
1099911999LABOR

<tbody>
</tbody>


The formula above may be overly cumbersome for what I'm trying to achieve, if there are simplification suggestions I'm happy to hear them!

Hopefully this make some sense, if not please let me know if there is additional information I can provide to help.

Thank you!
 
To help my understanding I went and created the table in post #2 above and used the formula you provided.


Good! That is how I recommend staring to figure out provided formulas.

I then went ahead and brought in a simplified version of some of my live data and structured it identically...


This is the second step exactly.

Now the next step is figuring out what adjustments (if any) are required to the formula to work on your actual data.

Unfortunately, I am unable to click on the provided link due to security reasons (work computer).
Can you share a sample of the data where the formula isn't working just like you did in post #1?
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Can you share a sample of the data where the formula isn't working just like you did in post #1?


I started to go down this road and ended up playing with the numbers some more and I've stumbled upon the problem, but no solution yet.

A little background - I'm pulling much of this data from an SQL database using a query through excel. In the data that is populating the Cost Pool Account Set Line, and specifically the From Account and To Account columns is a mix of both account numbers and some text entries.

When the query pulls this information in it is formatting everything as Text. Once I go into the test area of the sheet I attached using the formula you helped create in post #2 and manually key in some data, it works fine. Unfortunately manually keying in the data is not an option and it looks like I might have to live with excel pulling in the data AS text for both the To and From Account columns.

Any idea how to get around THAT? :confused:
 
Last edited:
Upvote 0
I started to go down this road and ended up playing with the numbers some more and I've stumbled upon the problem, but no solution yet.

A little background - I'm pulling much of this data from an SQL database using a query through excel. In the data that is populating the Cost Pool Account Set Line, and specifically the From Account and To Account columns is a mix of both account numbers and some text entries.

When the query pulls this information in it is formatting everything as Text. Once I go into the test area of the sheet I attached using the formula you helped create in post #2 and manually key in some data, it works fine. Unfortunately manually keying in the data is not an option and it looks like I might have to live with excel pulling in the data AS text for both the To and From Account columns.

Any idea how to get around THAT? :confused:

Did you try the suggestion of post #6 at all?
 
Upvote 0
Hi Aladin,

I just now had a chance to try your formula and, technically it worked, but I have so much data that it needs to parse through that it basically locked out my PC on the live spreadsheet and I had to end task the program after 20 minutes (it was at 14% complete).


I really appreciate you taking the time to help! If there is a more lightweight option you can think of, I'd love to give it a try!
 
Last edited:
Upvote 0
I started to go down this road and ended up playing with the numbers some more and I've stumbled upon the problem, but no solution yet.

A little background - I'm pulling much of this data from an SQL database using a query through excel. In the data that is populating the Cost Pool Account Set Line, and specifically the From Account and To Account columns is a mix of both account numbers and some text entries.

When the query pulls this information in it is formatting everything as Text. Once I go into the test area of the sheet I attached using the formula you helped create in post #2 and manually key in some data, it works fine. Unfortunately manually keying in the data is not an option and it looks like I might have to live with excel pulling in the data AS text for both the To and From Account columns.

Any idea how to get around THAT? :confused:

Sure, you can make the text values into numbers by highlighting the columns one at a time and using Text to Columns > Finish. If you don't want to do this, you can use this formula instead:


Excel 2010
ABCDEFG
1NumberLABORFRINGEFrom AccountTo AccountCost Pool Account Set Name
210000X1000010099LABOR
310100X1010010100FRINGE
411000X1099911999LABOR
511010X
Sheet1
Cell Formulas
RangeFormula
B2=IF(SUMPRODUCT(($E$2:$E$4+0<=$A2)*($F$2:$F$4+0>=$A2)*($G$2:$G$4=B$1)),"X","")
 
Last edited:
Upvote 0
Hi Aladin,

I just now had a chance to try your formula and, technically it worked, but I have so much data that it needs to parse through that it basically locked out my PC on the live spreadsheet and I had to end task the program after 20 minutes (it was at 14% complete).


I really appreciate you taking the time to help! If there is a more lightweight option you can think of, I'd love to give it a try!

The ranges in E:F of the dropbox link should be converted to true numbers.

The formula I suggested works swiftly for the dropbox sample, so care to post the formula as you really implemented it in your workbook?
 
Upvote 0
First, let me say you guys are awesome. I REALLY appreciate your help digging into this problem I'm having. Without it I wouldn't have been able to get as far as I have now. Let me narrow down what I see as the problem in achieving that and provided an example to illustrate it.

Problem: The data that I'm pulling into the spreadsheet through a query which populates the To Account and From Account columns has (mostly) numbers and some (required) text entries as well. This has been the root cause of some successful formulas already presented not functioning properly. I was slow to realize that this is what was causing the problem. Thank you for helping me to understand that.

Earlier int his thread falcon identified a working formula for data that is numerical is below. If ALL my data was numerical and defined as such when brought into the spreadsheet through a query in excel, this formula would work perfectly. I'm not sure if this can be built on with the (new) requirement of all data in this column being categorized as text.

=IF(COUNTIFS($E:$E,"<="&$A2,$F:$F,">="&$A2,$G:$G,B$1),"X","")

I've put together a revised spreadsheet in the drop box link below which includes some of these text values on Sheet 2. I apologize for not including these before (didn't realize they were the problem) but I've put some more thought into this example (it really is only a fraction of the data) and if there is a way to get the X in the proper boxes on this spreadsheet then I should be golden.

Again, thank you so much for your help!

https://www.dropbox.com/s/rlxg1vzlza6qmbt/COST POOL MATRIX - HELPv3.xlsx?dl=0


 
Upvote 0
So your actual data looks more like this? This is from the dropbox file.


Excel 2010
ABCDEFG
1NumberFringe BaseCRU GAFrom AccountTo AccountCost Pool Account Set Name
251101STAT CRU GASTAT CRU GACRU GA
3CRU GASTAT CRU OH AVISTAT CRU OH AVICRU OH AVI
4599215110051200Fringe Base
5811005992059940Fringe Base
6150707100071999Fringe Base
7911017910079100Fringe Base
8CRU OH AVI8100081999Fringe Base
98961089610Fringe Base
108971089710Fringe Base
119110091200Fringe Base
121507015070Fringe Base
Sheet2


What would be the expected outcome of a working formula for rows 3 and 8?
 
Upvote 0
So your actual data looks more like this?

Correct!

What would be the expected outcome of a working formula for rows 3 and 8?


Ideal outcome would be that the table populates as follows:


Excel 2010
ABCDEFG
1NumberFringe BaseCRU GAFrom AccountTo AccountCost Pool Account Set Name
251101XSTAT CRU GASTAT CRU GACRU GA
3STAT CRU GAXSTAT CRU OH AVISTAT CRU OH AVICRU OH AVI
459921X5110051200Fringe Base
581100X5992059940Fringe Base
615070X7100071999Fringe Base
791101X7910079100Fringe Base
8STAT CRU OH AVI8100081999Fringe Base
98961089610Fringe Base
108971089710Fringe Base
119110091200Fringe Base
121507015070Fringe Base

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2
If we were to add CRU OH AVI into D1 then D8 would have an X.
 
Upvote 0

Forum statistics

Threads
1,215,566
Messages
6,125,593
Members
449,237
Latest member
Chase S

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