VBA: Return first 10 values with criteria

JAnders

New Member
Joined
Feb 27, 2015
Messages
37
On SHEET "States": I have column B with a list of states, Column D has a list of corresponding dollar amount already in descending order & column A is a list of zip codes.
On Sheet "Highest": I have a state listed in cell A1, for cells A6:A15 I want to return the first 10 values that appear in column A on Sheet "States", if column B matches Sheet "Highest" A1. Repeat for returning first 10 values from column D on Sheet "States" if column B matches Sheet "Highest" A1.



Hopefully that makes sense.

I appreciate the help
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
How about
=INDEX(States!$A$2:$A$233,AGGREGATE(15,6,(ROW(States!$A$2:$A$233)-ROW(States!$A$2)+1)/(States!$B$2:$B$233=$A$1),ROWS($A$1:$A1)))
=INDEX(States!$D$2:$D$233,AGGREGATE(15,6,(ROW(States!$D$2:$D$233)-ROW(States!$D$2)+1)/(States!$B$2:$B$233=$A$1),ROWS($A$1:$A1)))
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,978
Messages
6,175,755
Members
452,667
Latest member
vanessavalentino83

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