#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default looking up a number

I am wanting to retreive data from an inputted list. What i want to do is
input a number and have the function give me the next highest and lowest
number.
Say for example

90
92.5
93.1
94.7
96.2
98.3

and i enter the number 95. the result should give me the values of 94.7 and
96.2. is this possible to do.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default looking up a number

Hi,

For the lower match

=VLOOKUP(95,A1:A6,1,TRUE)

for the higher match the array formula

=MIN(IF(A1:A6=95,A1:A6))

This is an array formula which must be entered with 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 ranges
'then you must re-enter as An array

Both will return an exact match if there is one.



Mike





"Soccer boy" wrote:

I am wanting to retreive data from an inputted list. What i want to do is
input a number and have the function give me the next highest and lowest
number.
Say for example

90
92.5
93.1
94.7
96.2
98.3

and i enter the number 95. the result should give me the values of 94.7 and
96.2. is this possible to do.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default looking up a number

If your list idoes not start on row 1, it can work.

Let's say your list is from A2 - A7.

Let's say your entered value is in cell C2

To get 94.7, it's

=INDEX(A2:A7,MATCH(C2,A2:A7,1))

To get 96.2, its

=INDEX(A2:A7,MATCH(C2,A1:A6,1))

Notice the match is tricked into looking at the prior cell for evaluation...

"Soccer boy" wrote:

I am wanting to retreive data from an inputted list. What i want to do is
input a number and have the function give me the next highest and lowest
number.
Say for example

90
92.5
93.1
94.7
96.2
98.3

and i enter the number 95. the result should give me the values of 94.7 and
96.2. is this possible to do.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default looking up a number

Another set of alternatives with dara in A1:A6 and B1=95:

=LOOKUP(B1,A1:A6)
=LOOKUP(2,1/FREQUENCY(B1,A1:A6),A1:A6)

"Soccer boy" wrote in message
...
I am wanting to retreive data from an inputted list. What i want to do is
input a number and have the function give me the next highest and lowest
number.
Say for example

90
92.5
93.1
94.7
96.2
98.3

and i enter the number 95. the result should give me the values of 94.7
and
96.2. is this possible to do.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default looking up a number

On Tue, 14 Apr 2009 13:42:06 -0700, Soccer boy
wrote:

I am wanting to retreive data from an inputted list. What i want to do is
input a number and have the function give me the next highest and lowest
number.
Say for example

90
92.5
93.1
94.7
96.2
98.3

and i enter the number 95. the result should give me the values of 94.7 and
96.2. is this possible to do.


What do you want if the number entered is exactly equal to one of the numbers
in the list?

What if the number entered is exactly equal to either the highest or lowest
numbers on the list?

This formula will return the same number for the lowest, if the number entered
is exactly equal to one in the list. It will return garbage for "next higher"
if the number entered is exactly equal to the highest number on the list.

There are no checks for number entered being out of range, but this is easily
added.

Next Lower: =OFFSET(ListOfNums,MATCH(Num,ListOfNums)-1,0,1)
Next Higher: =OFFSET(ListOfNums,MATCH(Num,ListOfNums),0,1)

--ron
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
How to calculate number of occurencies of a specific number number Stefan Excel Discussion (Misc queries) 4 September 8th 08 08:33 AM
Formula to change scientific number to regular number or text Compare Values Excel Discussion (Misc queries) 2 August 23rd 07 06:10 PM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM
Rounding a number to a multiple quantity that adds to a fixed total number wjlo Excel Worksheet Functions 1 November 9th 04 04:43 PM


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