Get second smallest & second largest from a range

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
My range is K2:V2 which generates values including 0 and also “” (blank)
I need formulas:
AA2=Second smallest non-zero non blank number from K2:V2 else 0
AB2= Second largest non-zero non blank number from K2:V2 else 0

How to accomplish?
Thanks in advance.
 
If you replace with 1 it will give the smallest - largest number.
So how to fill the corresponding cell in K4:V4 with 4 if the minimum is found in K2:V2 (minimum must not be 0 or "" blank)
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You mean like this?
Book1
KLMNOPQRSTUVWAAAB
1
201067141595420420
3
4         4  
Sheet3
Cell Formulas
RangeFormula
AA2AA2=IFERROR(SMALL(IF(K2:V2<>0,IF(K2:V2<>"",K2:V2)),1),0)
AB2AB2=IFERROR(LARGE(IF(K2:V2<>0,IF(K2:V2<>"",K2:V2)),1),0)
K4:V4K4=IF($AA$2<>0,IF(K2=$AA$2,$AA$2,""),"")
 
Upvote 0
Using Fluff's formula try:
Drag formula across columns.

Book1
KLMNOPQRSTUV
1
201067141595420
3
4         4  
Sheet3
Cell Formulas
RangeFormula
K4:V4K4=IFERROR(IF(AGGREGATE(15,6,$K$2:$V$2/($K$2:$V$2<>0),1)=K2,K2,""),"")
 
Upvote 0
Not exactly....in K4 I don't want to use $AA$2 instead I would prefer using the range $K$2:$V$2....K4 the formula needs to be modified
Like this?

24 02 21.xlsm
KLMNOPQRSTUV
1
201067141595420
3
4         4  
Min
Cell Formulas
RangeFormula
K4:V4K4=IF(K2=AGGREGATE(15,6,$K2:$V2/($K2:$V2<>0),1),K2,"")
 
Upvote 0
Solution

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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
Back
Top