Index Matching with Multiple Criteria and Greater Than

El_Dee_El

New Member
Joined
Jun 29, 2019
Messages
2
Hello,

Excel noob when it comes to Index Match and first time posting. TIA!

I am creating a spreadsheet to model portfolio trades based off of target trade amounts. I'm trying to prioritize the allocation of certain "Stock Types".

I'm wondering how I could retrieve a specific figure based off of multiple criteria and a greater than parameter.

ABCDEFGH
1Stock TypeGrowthBondGrowthReal
2Stock NameStockAStockBStockCStockDStock TypeGrowth
3First Trade1200300013005000TradeSecond Trade
4Second Trade0300013005000
5Third Trade0300005000

<tbody>
</tbody>

In summary, I'd like to determine how to pull the "Second Trade" amount based off of the "Stock Type" being classified as "Growth" and the value being greater than zero. I'd like the formula to return 1300 from D3 based off of H2 and H3. Thanks!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
A
B
C
D
E
F
G
H
1
Stock TypeGrowthBondGrowthReal
2
Stock NameStockAStockBStockCStockDStock TypeGrowth
3
First Trade
1200​
3000​
1300​
5000​
TradeSecond Trade
4
Second Trade
0​
3000​
1300​
5000​
5
Third Trade
0​
3000​
0​
5000​
6
1300​

<tbody>
</tbody>


G6=SUMPRODUCT(($A$3:$A$5=H3)*(B1:E1=H2)*(B3:E5<>0)*(B3:E5))
 
Upvote 0
Welcome to the MrExcel Board!

How about:

Excel 2012
ABCDEFGH
1Stock TypeGrowthBondGrowthReal
2Stock NameStockAStockBStockCStockDStock TypeGrowth
3First Trade1200300013005000TradeSecond Trade
4Second Trade0300013005000Amount1300
5Third Trade0300005000

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet5

Array Formulas
CellFormula
H4{=MAX(B3:E5*(B1:E1=H2)*(A3:A5=H3))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


You can also do it with this non-array entered formula:

=AGGREGATE(14,6,B3:E5/(B1:E1=H2)/(A3:A5=H3),1)

It really is an array formula under the covers, but you don't need to use the Control+Shift+Enter.
 
Upvote 0
It's probably worth noting the differences between Marziotullio's formula and mine. If you have multiple matching entries, his will return the sum of them. Mine (both of them) will return the maximum of the matching values. For example, if B4 is 200 instead of 0, his formula returns 1500, and mine 1300. So choose the one that suits your needs.
 
Upvote 0
Just getting around to testing this out. Thanks for the responses!

I'm not looking for the sum of several values. Eric's seems closer to what I need.

I should provide some more information. Each trade or Row is a result of the preceeding row. Therefore, the formula cannot pull from the entire range of B3:B5. For example, I have a cell specifying the first "First Trade" somewhere else. That first trade recognizes that there is a "Growth" with StockA and submits a trade for that reducing its availability to zero when it comes to the "Second Trade". The second trade should pull the next growth stock available which should be D4.

I just realized there was a type saying that the second trade should pull D3 instead of D4. I will go back and edit the original post.

All in all, how would I write the formula to focus on a row vs. the entire range? I tried to edit the aggregate formula but it gave me an error.
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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