Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default How to determine the closest value?

Does anyone have any suggestions on how to determine the closeest number?
Example One
There is a list of number under column A
191,189,183,177,175,171,167,165,159,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number in
cell B1. On above example, it should return 153 in cell C1.

Example Two
There is a list of number under column A
191,189,183,177,175,171,167,165,155,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number in
cell B1. On above example, if the given number matches two numbers, which the
difference is the same, then it should return 155 in cell C1.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default How to determine the closest value?

"Eric" wrote in message
...
Does anyone have any suggestions on how to determine the closeest number?
Example One
There is a list of number under column A
191,189,183,177,175,171,167,165,159,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number
in
cell B1. On above example, it should return 153 in cell C1.

Example Two
There is a list of number under column A
191,189,183,177,175,171,167,165,155,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number
in
cell B1. On above example, if the given number matches two numbers, which
the
difference is the same, then it should return 155 in cell C1.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric


One way:-
Start with VLOOKUP() to get an exact match if there is one or the next
highest number if not.
Then calc the differerence between the target and the VLOOKUP result
Then cal the difference between the target and the next lower cell to the
one returned by VLOOKUP
Then compare the 2 differences and use whatever logic you prefer to choose
the cell returned by VLOOKUP or the cell below it.

If your list is horizontal then use HLOOKUP instead.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default How to determine the closest value?

Hi,

Try this

=INDEX(A1:A11,MATCH(MIN(ABS(A1:A11-B1)),ABS(A1:A11-B1),))

This is an array formula which must be entered by pressing CTRL+Shift+Enter
and not just Enter. If you do it correctly then Excel will put curly brackets
around the formula {}. You can't type these yourself. If you edit the formula
you must enter it again with CTRL+Shift+Enter.

Mike

"Eric" wrote:

Does anyone have any suggestions on how to determine the closeest number?
Example One
There is a list of number under column A
191,189,183,177,175,171,167,165,159,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number in
cell B1. On above example, it should return 153 in cell C1.

Example Two
There is a list of number under column A
191,189,183,177,175,171,167,165,155,153,151
and there is a given number in cell B1, 154.
I would like to determine the closest number, which match with the number in
cell B1. On above example, if the given number matches two numbers, which the
difference is the same, then it should return 155 in cell C1.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric

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
Array Lookup to Find Closest Date and Next Closest Date [email protected] Excel Worksheet Functions 7 November 7th 07 03:04 AM
Lookup Closest Value chad Excel Worksheet Functions 3 September 29th 06 07:58 PM
Select value closest to... x3mist Excel Discussion (Misc queries) 4 July 17th 06 07:10 AM
closest match [email protected] Excel Worksheet Functions 4 June 11th 06 02:30 PM
vlookup-Closest value atatari New Users to Excel 5 February 6th 06 07:33 PM


All times are GMT +1. The time now is 07:27 PM.

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"