Vlookup unable to return the next cell that meets criteria

A_Filippo

New Member
Joined
Jul 12, 2019
Messages
2
I'm trying to build a table that lists a broker's volume from largest to smallest (top 10 firms only). If there are only 9 values in the data set, a zero will appear in the row.

To grab the volume, from largest to smallest, I'm using =LARGE($B$2:$B$63,1), =LARGE($B$2:$B$63,2), =LARGE($B$2:$B$63,3), ... =LARGE($B$2:$B$63,10). Then I'm doing a Vlookup to grab the corresponding firm. The issue arises when there is a duplicate volume number, it will grab the first firm in the data set multiple times instead of listing the second or third firm. How do I get excel to look for the next corresponding firm and IF there is a 0 in the volume row, to return a blank.


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Firm[/TD]
[TD="align: center"]Volume[/TD]
[/TR]
[TR]
[TD]National Bank[/TD]
[TD]12,000[/TD]
[/TR]
[TR]
[TD]CIBC World Markets[/TD]
[TD]10,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]Interactive Brokers[/TD]
[TD]2,000[/TD]
[/TR]
[TR]
[TD]PI Financial[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]PI Financial[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]RBC Financial[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]


The table should look like:

****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Firm[/TD]
[TD="align: center"]Volume[/TD]
[/TR]
[TR]
[TD]National Bank[/TD]
[TD]12,000[/TD]
[/TR]
[TR]
[TD]CIBC World Markets[/TD]
[TD]10,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]Interactive Brokers[/TD]
[TD]2,000[/TD]
[/TR]
[TR]
[TD]PI Financial[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]PI Financial[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]RBC Financial[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Firm[/TD]
[TD="align: center"]Volume[/TD]
[/TR]
[TR]
[TD]National Bank[/TD]
[TD]12,000[/TD]
[/TR]
[TR]
[TD]CIBC World Markets[/TD]
[TD]10,000[/TD]
[/TR]
[TR]
[TD]TD Securities[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]Morgan Stanley[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]Scotia Capital[/TD]
[TD]5,000[/TD]
[/TR]
[TR]
[TD]Interactive Brokers[/TD]
[TD]2,000[/TD]
[/TR]
[TR]
[TD]PI Financial[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]Haywood Securities[/TD]
[TD]1,000[/TD]
[/TR]
[TR]
[TD]RBC Financial[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the forum.

How about:


Book1
ABCDEF
1FirmVolumeFirmVolume
2CIBC World Markets10000National Bank12,000
3Scotia Capital5000CIBC World Markets10,000
4PI Financial1000Scotia Capital5,000
5TD Securities5000TD Securities5,000
6Interactive Brokers2000Morgan Stanley5,000
7Haywood Securities1000Interactive Brokers2,000
8National Bank12000PI Financial1,000
9Morgan Stanley5000Haywood Securities1,000
10RBC Financial500RBC Financial500
11
Sheet4
Cell Formulas
RangeFormula
E2=IF(F2<>"",INDEX($A:$A,AGGREGATE(15,6,ROW($B$2:$B$63)/($B$2:$B$63=F2),COUNTIF($F$2:$F2,F2))),"")
F2=IFERROR(LARGE($B$2:$B$63,ROWS($F$2:$F2)),"")
 
Upvote 0
That worked, amazing Eric. Spent many hours on Youtube and on here trying to piece this together. Enjoy your weekend and thanks again.
 
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