Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Top 10 Values

Hi All,

Assume I have two excel files. I'm having a file with the following
values in a workbook called First.xls under worksheet called 'data'. I
need to find the top 5 values and populate these values in a another
workbook(second.xls) in a worksheet called 'top 5 values'. How it can
be done? is it thru VBA or just thru functions like LARGE? Please help
me, as I'm not an expert in Excel.

Thanks
Easwara.

Data:

A1:A10
28
0
8
1
27
23
8
211
43
33

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Top 10 Values


His Easwara,

It can be done with something like this.

Sub Top5toNew()
Sheets("Sheet1").Range("a1:a10").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending
Range("a1:a5").Copy
Windows("second.xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

Regards,
P

--
patrickcairn
-----------------------------------------------------------------------
patrickcairns's Profile: http://www.excelforum.com/member.php...fo&userid=3179
View this thread: http://www.excelforum.com/showthread.php?threadid=51521

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Top 10 Values

Hi Patrick,

I'm new to VBA. I tried to run the code which you have sent.Should I
run this code thru VB editor in excel? Also, the files I get will come
in different row length. say first time the file comes with 100 rows,
where I find top 5. next time it comes with 344 rows. So, I need to
take into account this requirement too. we need to find the non-empty
rows in cell A, and then find the top 5 values.

Can you please explain me stepwise, what should I do to execute this
code perfectly? I've first.xls,second.xls c: drive.

Thanks
Easwara

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Top 10 Values

Easwara,

Can you not just use built in Excel filter? What I mean is; add a title row
to your data, 'Data-Filter-Auto Filter' on that cell/row - click the drop
down select 'Top 10' - change the 10 to a five hit OK & then you can copy
paste the result.

You could record that & tinker to automate - benefit would be that it does
not change you initial data (other than adding the title row).

Regards,

Chris.
--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


" wrote:

Hi All,

Assume I have two excel files. I'm having a file with the following
values in a workbook called First.xls under worksheet called 'data'. I
need to find the top 5 values and populate these values in a another
workbook(second.xls) in a worksheet called 'top 5 values'. How it can
be done? is it thru VBA or just thru functions like LARGE? Please help
me, as I'm not an expert in Excel.

Thanks
Easwara.

Data:

A1:A10
28
0
8
1
27
23
8
211
43
33


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Top 10 Values

Just use LARGE

=LARGE([Book1]Sheet1!$A$1:$A$10,ROW(A1))

and copy down for 4 rows

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

wrote in message
ups.com...
Hi All,

Assume I have two excel files. I'm having a file with the following
values in a workbook called First.xls under worksheet called 'data'. I
need to find the top 5 values and populate these values in a another
workbook(second.xls) in a worksheet called 'top 5 values'. How it can
be done? is it thru VBA or just thru functions like LARGE? Please help
me, as I'm not an expert in Excel.

Thanks
Easwara.

Data:

A1:A10
28
0
8
1
27
23
8
211
43
33





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 doesnt show Y-axis values when the values are small. outback Charts and Charting in Excel 2 October 26th 08 01:37 AM
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 9th 08 03:07 AM
Search/Filter to find values in another range based on two cell values Andy Excel Programming 2 April 29th 04 04:08 PM
How do I search thr'o column and put unique values in differnt sheet and sum corresponding values in test test Excel Programming 3 September 9th 03 08:53 PM
Predict Y-values on new X-values based on other actual X and Y values? NorTor Excel Programming 2 August 10th 03 03:08 PM


All times are GMT +1. The time now is 11:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"