Row of the Second Largest Number

chris000

New Member
Joined
Jun 6, 2015
Messages
1
Hi,

I have an array in cell A1:A6 with integers. Some of the number have duplicates. How can I know the row number of the second largest number if the first largest number and the second largest number are the same?

for example, I have
A1: 2
A2: 5
A3: 5
A4: 2
A5: 1

if I use match and large,
= MATCH(LARGE(A1:A6,1),A1:A6,0) = 2
= MATCH(LARGE(A1:A6,2),A1:A6,0) = 2, this should return 3.


Thank you very much
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Control+shift+enter, not just enter:

=SMALL(IF(A1:A5=LARGE(A1:A5,2),ROW(A1:A5)),COUNTIF(A1:A5,LARGE(A1:A5,2)))
 

MarcelBeug

Well-known Member
Joined
Apr 25, 2014
Messages
1,811
Aladin, I guess you mean ;)

Code:
=SMALL(IF(A1:A5=LARGE(A1:A5,2),ROW(A1:A5)),[B][COLOR="#FF0000"]2-[/COLOR][/B]COUNTIF(A1:A5,[B][COLOR="#FF0000"]">"&[/COLOR][/B]LARGE(A1:A5,2)))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,148
Messages
5,835,681
Members
430,375
Latest member
datdog22

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