+ Reply to Thread
Results 1 to 4 of 4

Return value if cell value is in between 2 numbers

  1. #1
    Registered User
    Join Date
    02-18-2015
    Location
    belgium
    MS-Off Ver
    Excel 2007
    Posts
    15

    Return value if cell value is in between 2 numbers

    Hi all,

    I want to create a formula that automatically converts wind speed (km/h) into a number on the Beaufort scale.

    I have some measurements of wind speed in km/h in cell A1 to A8:

    20,3
    35,9
    27,8
    20,6
    40,0
    19,9
    20,6
    27,9

    How can I make sure in cell B1:B8 that if the value:
    A < 1 => B = 0
    1 < A < 5 => B = 1
    5 < A < 11 => B = 2
    11 < A < 19 => B = 3
    19 < A < 28 => B = 4
    28 < A < 38 => B = 5
    38 < A < 49 => B = 6
    49 < A < 61 => B = 7
    61 < A < 74 => B = 8
    74 < A < 88 => B = 9
    88 < A < 102 => B = 10

    Thanks !
    Last edited by jones1234; 08-30-2018 at 04:26 PM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Return value if cell value is in between 2 numbers

    Looks to me like a "standard" lookup table + lookup function combination using the "approximate match" binary search option (4th argument of VLOOKUP()=TRUE). Unfortunately, almost all of the examples across the internet are for "exact match" lookups. I have an example here that illustrates the behavior of the approximate match lookup: https://www.excelforum.com/tips-and-...p-example.html

    1) Put your "lower bound" values into a column (0,1,5,12,...). Enter the associated Beaufort scale number in an adjacent column (to the right, if you are going to use VLOOKUP()) (0,1,2,3,...)
    2) Use a formula like =VLOOKUP(windspeed,absolute reference to lookup table from step 1,2,TRUE) where you want to return the Beaufort scale result.

    Unless there is something I am missing, it should be that easy.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    08-14-2018
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2016
    Posts
    118

    Re: Return value if cell value is in between 2 numbers

    Hi Jones
    Edit your lookup table.
    If A = 11.5 then what is the result ? (Same question for 74.5)
    28 < A < 38 => B = 5
    38 < A < 49 => B = 5 ??!
    then try this formula.
    Please Login or Register  to view this content.
    Where F1:P1 is {1,5,12,19,28,38,49,61,75,88,102} (Replace F1:P1 by this array if you don't want helper row)
    P.S:
    - With INDEX(), you can finish by pressing ENTER. Shorter ARRAY Formula is:
    Please Login or Register  to view this content.
    - My English is very bad, hope you understand what i'm saying.

  4. #4
    Registered User
    Join Date
    02-18-2015
    Location
    belgium
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Return value if cell value is in between 2 numbers

    Quote Originally Posted by congnt92 View Post
    Hi Jones
    Edit your lookup table.
    If A = 11.5 then what is the result ? (Same question for 74.5)

    then try this formula.
    Please Login or Register  to view this content.
    Where F1:P1 is {1,5,12,19,28,38,49,61,75,88,102} (Replace F1:P1 by this array if you don't want helper row)
    P.S:
    - With INDEX(), you can finish by pressing ENTER. Shorter ARRAY Formula is:
    Please Login or Register  to view this content.
    - My English is very bad, hope you understand what i'm saying.
    Hi,

    Thanks for the answer. The values in the table were indeed badly represented, I updated it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return numbers with certain text in adjacent cell
    By LeeBillington in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-19-2018, 01:58 PM
  2. [SOLVED] Return TRUE if cell contains certain “x” or numbers
    By esbencito in forum Excel General
    Replies: 4
    Last Post: 01-27-2018, 02:04 AM
  3. return numbers in a cell based upon words count in a cell
    By shtuamouth in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-19-2016, 02:19 PM
  4. Replies: 4
    Last Post: 05-17-2016, 01:33 AM
  5. Only return certain numbers from a cell
    By Jooakim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-20-2015, 07:25 AM
  6. [SOLVED] Count amount of desired numbers in a single cell and return that value in another cell
    By jmallory76 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-20-2013, 10:09 AM
  7. Replies: 3
    Last Post: 03-11-2012, 05:23 PM

Tags for this Thread

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