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.

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Stock Type[/TD]
[TD]Growth[/TD]
[TD]Bond[/TD]
[TD]Growth[/TD]
[TD]Real[/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Stock Name[/TD]
[TD]StockA[/TD]
[TD]StockB[/TD]
[TD]StockC[/TD]
[TD]StockD[/TD]
[TD][/TD]
[TD]Stock Type[/TD]
[TD]Growth[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]First Trade[/TD]
[TD]1200[/TD]
[TD]3000[/TD]
[TD]1300[/TD]
[TD]5000[/TD]
[TD][/TD]
[TD]Trade[/TD]
[TD]Second Trade[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Second Trade[/TD]
[TD]0[/TD]
[TD]3000[/TD]
[TD]1300[/TD]
[TD]5000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Third Trade[/TD]
[TD]0[/TD]
[TD]3000[/TD]
[TD]0[/TD]
[TD]5000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[TD]
E
[/TD]
[TD]
F
[/TD]
[TD]
G
[/TD]
[TD]
H
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]Stock Type[/TD]
[TD]Growth[/TD]
[TD]Bond[/TD]
[TD]Growth[/TD]
[TD]Real[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]Stock Name[/TD]
[TD]StockA[/TD]
[TD]StockB[/TD]
[TD]StockC[/TD]
[TD]StockD[/TD]
[TD][/TD]
[TD]Stock Type[/TD]
[TD]Growth[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]First Trade[/TD]
[TD]
1200​
[/TD]
[TD]
3000​
[/TD]
[TD]
1300​
[/TD]
[TD]
5000​
[/TD]
[TD][/TD]
[TD]Trade[/TD]
[TD]Second Trade[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]Second Trade[/TD]
[TD]
0​
[/TD]
[TD]
3000​
[/TD]
[TD]
1300​
[/TD]
[TD]
5000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]Third Trade[/TD]
[TD]
0​
[/TD]
[TD]
3000​
[/TD]
[TD]
0​
[/TD]
[TD]
5000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
1300​
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


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
Stock TypeGrowthBondGrowthReal
Stock NameStockAStockBStockCStockDStock TypeGrowth
First TradeTradeSecond Trade
Second TradeAmount
Third Trade

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]1200[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]1300[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]1300[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"][/TD]

[TD="align: right"]1300[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet5

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H4[/TH]
[TD="align: left"]{=MAX(B3:E5*(B1:E1=H2)*(A3:A5=H3))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]


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,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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