View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Vacation's Over Vacation's Over is offline
external usenet poster
 
Posts: 279
Default sorting by sector and find largest 3 number each macro help ne

lots of ways to aproach this. BEST way depends on how it will be used, user
abilities, do you need choices to asc/desc 3 or 5 shown and so on.

For starters DataSort by sector then by net sales will give you the full
sorted list.(asc / Dsc choice is yours)

Then you could throw in an if formula in the next column so if sector
matches the previous row add one else start again at 1

say - D3 =If(B3 = B2,D2 + 1,1)
So now you have a column that shows the running ranking of each sector and
you can get a macro to hide rows where column D is greater than 3 - for the
top 3 list
if sorted desc. & bottom 3 if sorted asc.

Do not include D column in the sorting

hope this helps

"barkiny" wrote:


i dont want to use pivot table because there are many other search
criterias based on that dataset and it wont be practical for other
users or when the data range changes over time

it has to be vba code

thanx in advance


--
barkiny
------------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=396461