TOP 15 records from based on industry

  • Thread starter Thread starter robertB
  • Start date Start date
R

robertB

I have about 4,000 rows of data that i bring out of ACCESS and paste i
into EXCEl. What i am trying to do is take the "TOP 15" ROWS of dat
and paste it in another sheet for each industry in desceding order b
total exposure.

There are 78 different industries and there can be anywhere between
record per industry to 100+. I only need to grab the "TOP 15".

I think i may have figured some of it out. but i there is probably
better way of doing it. The hardest part is distiguishing when th
industry's change then start copying the next 15/

Anyone have any ideas?
THanks
example of industries:
Column A: COLUMN B:
AUTOS 15000
BANKING 15555
Communications 456416
TELECOM 456461
etc....

Some sameple code:
I = Range("A65536").End(xlUp).Row
For J = 1 To 7 Step 1
If Cells(J, 1).Value = "AUTO" Then
Cells(J, 1).Value = Cells(J, 5).Value
Cells(J, 2).Value = Cells(J, 6).Value

End If

Next
Loo
 
use the Autofilter with the top 10 option (you can change it to 15).

Use a list of the unique industries and apply that sequentially (in code,
loop through the list) as part of the filter process.

Turn on the macro recorder while you do it manually to get the basic code.
 
SELECT TOP N is proprietary Jet SQL syntax (ANSI standard syntax is
also available to make your code portable). Therefore, you may be
better off doing this query in MS Access as well, exporting the
results to your workbook. Alternatively, you can query an Excel
workbook using the MS OLEDB provider for Jet via ADO code i.e. you can
run a query an Excel workbook using the same SQL syntax as you would
for your MS Access database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top