+ Reply to Thread
Results 1 to 5 of 5

How can I find the range in which is cell falls when the ranges are not continuous?

  1. #1
    Registered User
    Join Date
    06-25-2019
    Location
    south, US
    MS-Off Ver
    365
    Posts
    2

    How can I find the range in which is cell falls when the ranges are not continuous?

    In Tab 1 i have a list of individual 5-digit codes. Each code is a specific type of hospital procedure. In tab 2 I have a list of hospital procedures names and the ranges of 5-digit codes that fall into that procedure. The ranges are NOT continuous and have gaps in them. For example, one procedure might include all codes between 69600 - 69900 and the next might include all codes 70215 - 71005. I have 184 different procedures, each with its own range of codes. I need to look at the individual codes that I have in tab 1 (over 50,000 of them), determine which range of codes the individual cold falls into, and pull back the corresponding procedure name. However, since the code ranges are not continuous and there are gaps, I'm having trouble figuring out how to pull back the correct name for the individual code. Is there a simple way to do this?

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How can I find the range in which is cell falls when the ranges are not continuous?

    depending on how your data is laid out, you could use a vlookup with a true statement at the end. See the attached.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How can I find the range in which is cell falls when the ranges are not continuous?

    sorry, forgot to attach.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-25-2019
    Location
    south, US
    MS-Off Ver
    365
    Posts
    2

    Re: How can I find the range in which is cell falls when the ranges are not continuous?

    it is set up so that in the tab with all of the code ranges, column A is the code name, B is the lower code limit, and C is the upper code limit.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How can I find the range in which is cell falls when the ranges are not continuous?

    That really doesn't change the answer. Just a tweak to make it =VLOOKUP(A3,'tab2'!A:C,3,TRUE)
    if you want something more specific go advanced and upload a workbook so we can give you a better answer.
    The vlookup with a TRUE at the end works by looking at a "sorted" A-Z list and it will return a value that either matches or is the closest match to it. The C you refer to as the upper limit isn't really needed. So if you are looking for 69601 and 69600 is in your tab and also 69900 is the next one is 70215 and 71005 then it will return the value across from 69600. See attached.
    Attached Files Attached Files

+ 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. CountA in non-continuous cell ranges - data type mismatch
    By lifeseeker1019 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2014, 06:45 PM
  2. Replies: 4
    Last Post: 11-04-2014, 04:22 PM
  3. Replies: 4
    Last Post: 05-15-2014, 01:13 PM
  4. [SOLVED] Need to find which cell a number falls into in multiple ranges.
    By bmhalula in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2012, 08:48 AM
  5. Replies: 20
    Last Post: 08-02-2012, 10:48 AM
  6. find continuous data range
    By ConfusedToo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2009, 11:48 AM
  7. Find which range a name falls into?
    By madbloke in forum Excel General
    Replies: 2
    Last Post: 02-21-2007, 05:02 AM

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