Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Finding 2nd smallest number in range

I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Finding 2nd smallest number in range

=SMALL(IF(A1:A10<0,A1:A10),2)
array formula so enter with Shift+Ctrl+Enter
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Finding 2nd smallest number in range

Did you try this : =SMALL(A1:A100,2) this formula ignores text, blank cells and
"0"
HTH
John
"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Finding 2nd smallest number in range

Thanks Bernard, this formula only works when all values in the range are
different. What about duplicate values?

"Bernard Liengme" wrote:

=SMALL(IF(A1:A10<0,A1:A10),2)
array formula so enter with Shift+Ctrl+Enter
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Finding 2nd smallest number in range

OOPS, it does't ignore "0" sorry
I see you have a response to your problem.
Regards
John
"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Finding 2nd smallest number in range

Hi John, thanks for the reponse, my problem is with multiple values in a
range of cells, any ideas?

"John" wrote:

OOPS, it does't ignore "0" sorry
I see you have a response to your problem.
Regards
John
"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Finding 2nd smallest number in range

Hi Rachel
Sorry don't know it, wait and see from the others, then will both know it.
Sorry
John
"Rachel7" wrote in message
...
Hi John, thanks for the reponse, my problem is with multiple values in a
range of cells, any ideas?

"John" wrote:

OOPS, it does't ignore "0" sorry
I see you have a response to your problem.
Regards
John
"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the range
contains empty cells, multiple values & zero values. I need to ignore the
empty cells, multiple values & zero values - can this be done?




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Finding 2nd smallest number in range

Can be done with VBA
If you are not too familiar with VBA see David McRitchie's site on "getting
started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Copy this to a general macro sheet and on the worksheet use in as in
=Nextsmall(A1:A20)

Function nextsmall(rng)
Small = WorksheetFunction.Max(rng)
For Each num In rng
If num < 0 And num < Small Then
Small = num
End If
Next
Debug.Print "Small " & Small
mytest = WorksheetFunction.Max(rng)
For Each num In rng
If IsNumeric(num) And num < 0 And num < Small Then
If num < mytest Then
mytest = num
End If
End If
Next
nextsmall = mytest
End Function

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
Thanks Bernard, this formula only works when all values in the range are
different. What about duplicate values?

"Bernard Liengme" wrote:

=SMALL(IF(A1:A10<0,A1:A10),2)
array formula so enter with Shift+Ctrl+Enter
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the
range
contains empty cells, multiple values & zero values. I need to ignore
the
empty cells, multiple values & zero values - can this be done?






  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Finding 2nd smallest number in range

Thanks Bernard, I'll give it a whirl...

"Bernard Liengme" wrote:

Can be done with VBA
If you are not too familiar with VBA see David McRitchie's site on "getting
started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Copy this to a general macro sheet and on the worksheet use in as in
=Nextsmall(A1:A20)

Function nextsmall(rng)
Small = WorksheetFunction.Max(rng)
For Each num In rng
If num < 0 And num < Small Then
Small = num
End If
Next
Debug.Print "Small " & Small
mytest = WorksheetFunction.Max(rng)
For Each num In rng
If IsNumeric(num) And num < 0 And num < Small Then
If num < mytest Then
mytest = num
End If
End If
Next
nextsmall = mytest
End Function

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
Thanks Bernard, this formula only works when all values in the range are
different. What about duplicate values?

"Bernard Liengme" wrote:

=SMALL(IF(A1:A10<0,A1:A10),2)
array formula so enter with Shift+Ctrl+Enter
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Rachel7" wrote in message
...
I need to return the 2nd smallest number in a range of cells, but the
range
contains empty cells, multiple values & zero values. I need to ignore
the
empty cells, multiple values & zero values - can this be done?






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
Finding the number of times a word is used in a range of cells Ray Hill Excel Worksheet Functions 8 January 15th 09 07:21 PM
Finding Minimum but if same number repeats in the range, then find MIK Excel Discussion (Misc queries) 1 January 9th 09 03:13 AM
Find X number of smallest values in a range Steve Haack Excel Worksheet Functions 1 August 14th 07 05:02 AM
Formatting smallest number in a range? penglvr Excel Worksheet Functions 3 June 9th 06 05:27 PM
Finding Smallest Value Phil Excel Discussion (Misc queries) 5 May 29th 06 01:27 AM


All times are GMT +1. The time now is 11:04 AM.

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

About Us

"It's about Microsoft Excel"