+ Reply to Thread
Results 1 to 2 of 2

Closest Number

  1. #1
    Forum Contributor
    Join Date
    09-27-2004
    Posts
    133

    Question Closest Number

    I have a column of numbers,e.g.

    0.12
    0.13
    0.18
    0.25
    0.30

    They are each part of any array, i.e. y(1), y(2),...,y(5).

    I want to find the closest number in this array to another number, say 0.15. I want to query each number until I get to the first number in the column that is greater than 0.15. Then I know that the correct value is the entry prior to that one.

    Help is greatly appreciated.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Closest Number

    =Lookup(2,1/(A1:A5<=X1),A1:A5)

    That formula will do both.

    It finds the last value that is less than or equal to the input value (in X1)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1