second best

paj*

New Member
Joined
Jun 18, 2007
Messages
10
Hi

How can I get the second best or second worst value out of an array?

I am searching for something like min(array; position(e.g. 2nd)).

Thanks in advance

paj*
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Use the LARGE Function for second best(largest) and SMALL for 2nd Works (smallest)

x = worksheetfunction.large(range("a:a"),2)

or

x = worksheetfunction.small(range("a:a"),2)
 
Upvote 0

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,961
Office Version
  1. 365
Platform
  1. Windows
If you have duplicates and don't want to count the duplicates.
For example if the highest number is 4 but there are two fours in this column, and down't want to count the second 4 as the second highest number, perhaps:

For the 2nd highest number:
=LARGE(G1:G5,1+COUNTIF(G1:G5,MAX(G1:G5)))

For the 2nd lowest number:
=SMALL(G1:G5,1+COUNTIF(G1:G5,MIN(G1:G5)))
 
Upvote 0

paj*

New Member
Joined
Jun 18, 2007
Messages
10
Thanks mates

But how can I do the following

I got 3 cells, one for the best, second for the second, third for the guess what?

All my values are in the array
g1:g10

no I got 3 numbers having the same value

how can I achieve that they all 3 are displayed in those 3 cells? In this case order doesn't matter, but I want to display all 3 as they are the best three
 
Upvote 0

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,961
Office Version
  1. 365
Platform
  1. Windows
Best:
=MAX(G1:G10) or =LARGE(G1:G10,1)

2nd Best
=LARGE(G1:G10,2)

3rd Best
=LARGE(G1:G10,3)
 
Upvote 0

Forum statistics

Threads
1,191,524
Messages
5,987,103
Members
440,079
Latest member
MarchePR

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
Top