+ Reply to Thread
Results 1 to 5 of 5

Return Column String based on ID and Range (min and max).

  1. #1
    Registered User
    Join Date
    06-26-2018
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    18

    Return Column String based on ID and Range (min and max).

    Hi everyone,

    This problem has been bugging me for a few days now. I started doing it manually in a data base (had 150 odd to go through), but knew there must be a better way. That and I have another set with 1000's of entries next. Hoping someone can help.

    I have attached my spreadsheet problem.

    The algorithm I am trying to achieve is as such:

    In sheet 1: Column C, I would like to return the name from Sheet 2: Column B based on these conditions:

    For each cell in the range of Sheet 1 - Range (C2:C154)

    1. Starting at Sheet 1 Cell: C2 as output cell.

    2. Use data from Sheet 1 Cells A1 and B2 as the conditions i.e. "ID" - CFE021 and "Setting Number" - 432.6

    3. I would like to lookup the ID in the first column of Sheet 2 (note there are multiple entries) and match with CFE021

    4. This is where the Setting number comes in (432.6). I would like to find the row for the "ID" that the Setting number sits within the ranges on Sheet2 (Lower limit and Upper limit). In this instance, it would be sheet 2 - row34 (as 432.6 sits between the values 362.87 and 485.1)

    5. Once this row in Sheet 2 is known, I would like the return the string in Column B, of that row. In this instance the the string is "Phillip" which is Cell B34.

    6. Repeat alogithm for each cell in range C2:C154 of Sheet1


    Hoping an Excel wizz out there can help. Currently banging my head against the wall!!

    Regards,
    Jackson
    Attached Files Attached Files
    Last edited by Jackson2806; 07-24-2020 at 09:59 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    07-23-2020
    Location
    Sacramento, California
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Return Column String based on ID and Range (min and max).

    Try putting this in cell C2

    =IFERROR(INDEX(Sheet2!$A$2:$D$5000,SUMPRODUCT(--(Sheet2!$A$2:$A$5000=$A2),--(Sheet2!$C$2:$C$5000<$B2),--(Sheet2!$D$2:$D$5000>$B2),ROW($A$2:$A$5000))-1,2),"")

    This will get your answer, and when the setting number doesn't land within any range, it will give you a blank.

    In other words when it comes up as an error, it will give you a blank...

    If you want it to say something like: "ERROR", or like: "NA", then put your desired text between the last set of quotes.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Return Column String based on ID and Range (min and max).

    Another solution:

    Please Login or Register  to view this content.
    Quang PT

  4. #4
    Registered User
    Join Date
    06-26-2018
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    18

    Re: Return Column String based on ID and Range (min and max).

    Hi Chrisdontm, works well. Thank you so much!

  5. #5
    Registered User
    Join Date
    06-26-2018
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    18

    Re: Return Column String based on ID and Range (min and max).

    Hi bebo021999, this also works perfect! Thanks for providing your help! Massive time saver....

    Regards,
    Jackson

+ 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. Return value from based on column range value
    By itlyi2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2019, 08:57 AM
  2. [SOLVED] Vlookup part of a string in a column range and return all results transposed in a row
    By Thistledown in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-15-2019, 08:10 AM
  3. Highlight column range based on multiple cell string match
    By ~TaC~ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2019, 11:01 AM
  4. [SOLVED] Check if other strings exist in column based on range string values
    By jeroenft in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2018, 11:47 AM
  5. [SOLVED] Check if other strings exist in column based on range string values
    By jeroenft in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-12-2018, 07:49 AM
  6. [SOLVED] IF statement to return string based on highest value in range of columns
    By SeskaLien in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2015, 10:10 PM
  7. [SOLVED] user defined function to return a string value based on two column matches
    By Ed C in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2012, 11:02 AM

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