+ Reply to Thread
Results 1 to 5 of 5

Formula - automatically select a value range

  1. #1
    Registered User
    Join Date
    09-15-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    2

    Formula - automatically select a value range

    Morning everyone

    I have a data set of numbers and I would like to write a formula which selects the range that the value falls into.

    i.e. one of my numbers in the data set is 100. My range values are 0-50, 51-100, 101-150, etc, and 0-50 corresponds to "set 1", 51-100 to "set 2", 101-150 to "set 3".

    I'd like my formula to return "set 2".

    I can write a cumbersome IF formula but there is an easier way - can anyone please assist?
    Thanks very much

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: Formula - automatically select a value range

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by zbor; 09-15-2014 at 05:20 AM.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula - automatically select a value range

    Hi,

    Create a small two column table with your set limits, 0, 51, 101 etc in column 1 and 'set 1', 'set 2' etc.. in the adjacent column.
    Now use a VLOOKUP() function. e.g.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Formula - automatically select a value range

    =LOOKUP(A1,{0,51,101},{1,2,3})
    extend the numbers in {} if there are more sets

    or

    =INT((A1-1)/50)+1

    will produce the correct result irrespective of how many sets there are
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Registered User
    Join Date
    09-15-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    2

    Re: Formula - automatically select a value range

    excellent, thanks all for the help

+ 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. Automatically select range with known first cell
    By drakaz in forum Excel General
    Replies: 4
    Last Post: 04-08-2014, 09:13 AM
  2. [SOLVED] Macro to automatically select a range
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-16-2014, 06:55 AM
  3. Automatically select filled cells range in textbox
    By Cleopatran in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2014, 06:23 AM
  4. Dynamic chart automatically changing its range if we select wrong date
    By maniknandi in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-06-2013, 12:46 AM
  5. Automatically Select Range Before Saving
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2010, 07:18 PM

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