Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default find largest data

Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in kolumn2)
name2 .... (sum = 2 largest data of name2 in kolumn2)
name3 .... (sum = 2 largest data of name3 in kolumn2)
etc....

Thanks for any help

Regards
Mark






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default find largest data

=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$B $200),{1,2}))

Entered in B1 on the second sheet using Ctrl+Shift+Enter Rather than just
enter. (since this is an array formula) Then drag fill down the column

Adjust the reference to rows 1 to 200 to match your data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in kolumn2)
name2 .... (sum = 2 largest data of name2 in kolumn2)
name3 .... (sum = 2 largest data of name3 in kolumn2)
etc....

Thanks for any help

Regards
Mark








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default find largest data

Tom,
I can't use your formula.
Function return only secend largest data (i want sum first
and secend)
I'd like in result operation haven't repeat the same name.
I have excel 2k.
Can do it in VBA?

Many thanks in anticipation!
Best regards
mark


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$ B$200),

{1,2}))

Entered in B1 on the second sheet using Ctrl+Shift+Enter

Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default find largest data

Ctrl+Shift+Enter doesn't work.
I check it on another PC - work.
Where is set-up Ctrl+Shift+Enter in Excel?


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$ B$200),

{1,2}))

Entered in B1 on the second sheet using Ctrl+Shift+Enter

Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default find largest data

If you enter it as I instructed, it will do what you describe. It is
usually not advisable to use VBA if a worksheet function can do the job.

If you want code:

Sub GetTop2()
Dim rng As Range
Dim cell as Range
Dim dblTot as Double
With Worksheets("Sheet2")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
For Each cell In rng
dblTot = Evaluate("SUM(LARGE(IF(Sheet1!$A$1:$A$200=" _
& Chr(34) & cell.Value & Chr(34) & _
",Sheet1!$B$1:$B$200),{1,2}))")
cell.Offset(0, 1).Value = dblTot
Next


End Sub

--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
Tom,
I can't use your formula.
Function return only secend largest data (i want sum first
and secend)
I'd like in result operation haven't repeat the same name.
I have excel 2k.
Can do it in VBA?

Many thanks in anticipation!
Best regards
mark


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$ B$200),

{1,2}))

Entered in B1 on the second sheet using Ctrl+Shift+Enter

Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default find largest data

Ctrl+Shift+Enter works fine. I tested the formula again and it works just
fine.

By the way, my code assumes on sheet2 you have a list of the unique names in
column A starting in A1.



--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
Ctrl+Shift+Enter doesn't work.
I check it on another PC - work.
Where is set-up Ctrl+Shift+Enter in Excel?


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$ B$200),

{1,2}))

Entered in B1 on the second sheet using Ctrl+Shift+Enter

Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default find largest data

Tom!
It's work excellant in VBA! Thanks a lot!!!
I wonder why I can't use function in the form:
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$B $200),
{1,2}))
My excel don't accept comma(,)only semicolon (;).
When I change comma for semicolon and use array formula
function result is only second largest name.
Help, please.
Regards
Mark


-----Original Message-----
If you enter it as I instructed, it will do what you

describe. It is
usually not advisable to use VBA if a worksheet function

can do the job.

If you want code:

Sub GetTop2()
Dim rng As Range
Dim cell as Range
Dim dblTot as Double
With Worksheets("Sheet2")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
For Each cell In rng
dblTot = Evaluate("SUM(LARGE(IF(Sheet1!$A$1:$A$200=" _
& Chr(34) & cell.Value & Chr(34) & _
",Sheet1!$B$1:$B$200),{1,2}))")
cell.Offset(0, 1).Value = dblTot
Next


End Sub

--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
Tom,
I can't use your formula.
Function return only secend largest data (i want sum

first
and secend)
I'd like in result operation haven't repeat the same

name.
I have excel 2k.
Can do it in VBA?

Many thanks in anticipation!
Best regards
mark


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!

$B$1:$B$200),
{1,2}))

Entered in B1 on the second sheet using

Ctrl+Shift+Enter
Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your

data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.



.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default find largest data

Try like this...
the row is a trick to force the array issue...

=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1;Sheet1!$B$1:$B $200);ROW(INDIRECT
("1:2"))))

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Mark" wrote:

=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!$B$1:$B $200),
{1,2}))


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default find largest data

I know why I can't used Ctrl+Shift+Enter.
After open Excel i had hotkeys Ctrl+Shift+Enter in another
application.
I managed with it when i disconnect hotkeys before open
Excel.

Best regards
Mark


-----Original Message-----
Ctrl+Shift+Enter works fine. I tested the formula again

and it works just
fine.

By the way, my code assumes on sheet2 you have a list of

the unique names in
column A starting in A1.



--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
Ctrl+Shift+Enter doesn't work.
I check it on another PC - work.
Where is set-up Ctrl+Shift+Enter in Excel?


-----Original Message-----
=SUM(LARGE(IF(Sheet1!$A$1:$A$200=A1,Sheet1!

$B$1:$B$200),
{1,2}))

Entered in B1 on the second sheet using

Ctrl+Shift+Enter
Rather than just
enter. (since this is an array formula) Then drag fill

down the column

Adjust the reference to rows 1 to 200 to match your

data.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi,

I have data in column:

Kolumn1 Kolumn2

name1 5,5
name2 6,3
name1 7,9
name1 8,4
name1 3,2
name1 9,9
name2 1,2
name2 2,2
name3....etc.(a few thousand records)

How make choice in VBA data in Kolumn1?
Result operation:
(in another sheet)
Kolumn1 Kolumn2
name1 .... (sum = 2 largest data of name1 in

kolumn2)
name2 .... (sum = 2 largest data of name2 in

kolumn2)
name3 .... (sum = 2 largest data of name3 in

kolumn2)
etc....

Thanks for any help

Regards
Mark








.



.

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
I need find largest value in row Lion2004 Excel Discussion (Misc queries) 11 October 15th 07 02:08 PM
Find Smallest and Largest. dlbeiler Excel Worksheet Functions 5 October 10th 07 02:16 PM
How to find the largest value in a column? needofhelp Excel Discussion (Misc queries) 2 December 28th 06 07:34 PM
Find 2nd Largest Value Session101 Excel Worksheet Functions 2 April 10th 06 09:16 PM
How do I find the largest in a column BigBuck98 Excel Worksheet Functions 5 January 10th 06 12:11 AM


All times are GMT +1. The time now is 03:03 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"