LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default lowest of two closest numbers

If the range of number is already in ascending order....

Using the same example:
With A1:A10 containing: {3; 50; 101; 200; 215; 312; 475; 619; 812; 1000}

This ARRAY FORMULA returns the lower of the 2 sequental values with the
smallest difference:
=INDEX(A1:A10,MATCH(SMALL(A2:A10-A1:A9,1),A2:A10-A1:A9,0))
or...
this non-array version:
=INDEX(A1:A10,INDEX(MATCH(SMALL(A2:A10-A1:A9,1),A2:A10-A1:A9,0),0))

Again...
the smallest difference is between 200 and 215
so the formula returns: 200

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"Ron Coderre" wrote in message
...
If the numbers are not in any particular order....

With A1:A10 containing: {3; 312; 50; 215; 619; 101; 200; 1000; 475; 812}

This ARRAY FORMULA, committed with CTRL+SHIFT+ENTER, instead of just
ENTER...
-Sorts the range in ascending order
-Calculates the differences between those values
-Returns the smallest value of the pair with the smallest difference
=INDEX(SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT (A1:A10)-1))),MATCH(SMALL(SMALL($A$1:$A$10,ROW($A$1:INDEX($ A:$A,COUNT(A1:A10)-1))+1)-SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT(A1:A10 )-1))),1),SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUN T(A1:A10)-1))+1)-SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT(A1:A10 )-1))),0))

Since text wrap will probably impact the display, here's that formula in
sections:
=INDEX(SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT (A1:A10)-1))),
MATCH(SMALL(SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A, COUNT(A1:A10)-1))+1)
-SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT(A1:A10 )-1))),1),
SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT(A1:A10 )-1))+1)
-SMALL($A$1:$A$10,ROW($A$1:INDEX($A:$A,COUNT(A1:A10 )-1))),0))

Using my sample data....
the smallest difference is between 200 and 215.
The formula returns: 200

Is that something you can work with?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Susie (SFAngelgirl)" <Susie
wrote in message
...
excel 2003
In comparing a range of numbers; I need to find the two closest numbers
and
have the lowest value returned. Anybody?

Susie - SFAngelgirl





 
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
Trying to display the number between two numbers closest to another value [email protected] Excel Worksheet Functions 2 October 10th 07 02:34 PM
How do you add the three lowest numbers in a column? Bearkat Excel Worksheet Functions 2 April 6th 06 05:07 PM
find closest match to a reference number in a row of numbers Nick Krill Excel Discussion (Misc queries) 4 December 21st 05 11:59 AM
Lowest numbers One-Leg Excel Discussion (Misc queries) 7 May 26th 05 08:06 PM
Possible to pick out the lowest eight numbers in a row? Christian Borchgrevink-Vigeland Excel Discussion (Misc queries) 4 December 23rd 04 03:53 PM


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