+ Reply to Thread
Results 1 to 9 of 9

Return the value that falls within multiple ranges

Hybrid View

Kip2024 Return the value that falls... 07-05-2024, 10:47 AM
AliGW Re: Return the value that... 07-05-2024, 11:11 AM
FlameRetired Re: Return the value that... 07-05-2024, 09:43 PM
Gregb11 Re: Return the value that... 07-05-2024, 10:46 PM
Kip2024 Re: Return the value that... 07-09-2024, 02:04 PM
Gregb11 Re: Return the value that... 07-09-2024, 07:42 PM
Kip2024 Re: Return the value that... 07-09-2024, 09:09 PM
Gregb11 Re: Return the value that... 07-09-2024, 09:18 PM
Kip2024 Re: Return the value that... 07-10-2024, 03:40 PM
  1. #1
    Registered User
    Join Date
    07-05-2024
    Location
    NJ
    MS-Off Ver
    Microsoft 365, Spreadsheets
    Posts
    4

    Return the value that falls within multiple ranges

    Hello,

    I'm looking for some help with a project I'm working on. I need to assign codes from Sheet 2 to Sheet 1 based on specific criteria.
    Specifically, I want to match the codes on Sheet 2 to the specifications on Sheet 1, ensuring they fall within the appropriate ranges defined on Sheet 2.

    I was trying to use IF(AND(C3>=Sheet2!C3:C, C3<=Sheet2!D3:D), C3, 0) something like this to return the value falls within the range on Sheet2 but it seems meaningless and don't have a clue to where to start.

    Does anyone have any ideas or suggestions on how to approach this?
    Any advice to get me started would be greatly appreciated!

    == Updated 7/9==

    Thank you all for your replies.
    Here is the expected results below: There should be N/A if the dataset do not fall into the range of the code data.
    20240709_134537.png


    And here is the updated excel file:
    Book20.xlsx

    I also tried something like this and it is not working of course:
    =INDEX($K$2:$K$22,MATCH(FILTER($L$2:$L$22,($L$2:$L$22=A3)*($M$2:$M$22=B3)*($N$2:$N$22=C3)*($O$2:$O$22<=D3)*($P$2:$P$22>=D3)*($Q$2:$Q$22<=E3)*($R$2:$R$22>=E3)*($S$2:$S$22<=F3)*($T$2:$T$22>=F3),"N/A"),$K$2:$T$22,0))
    I think I should understand the array formula first and it feels overwhelming at the moment
    20240709_135037.png
    Last edited by Kip2024; 07-10-2024 at 03:40 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,208

    Re: Return the value that falls within multiple ranges

    Please fill in some expected results manually and post the sample sheet again. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Return the value that falls within multiple ranges

    Removed by FR. Waiting for additional information.
    Last edited by FlameRetired; 07-05-2024 at 09:47 PM.
    Dave

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,168

    Re: Return the value that falls within multiple ranges

    I'm assuming you're wanting a formula to go into cell F3 on Sheet1 (and copied down)? I know you're going to supply another sample file with expected results, but please make sure to explain those results. If I just look at your current data, I don't know what would go in the CODE column for row 3. Initially I would say Code: CPR2004, as the 50 fits within the range for CW, but the value for GA doesn't fit in the range, nor does the WD Value. I'm sure it will be made clear once you post again

  5. #5
    Registered User
    Join Date
    07-05-2024
    Location
    NJ
    MS-Off Ver
    Microsoft 365, Spreadsheets
    Posts
    4

    Re: Return the value that falls within multiple ranges

    Hello, I updated my original post, could you please take a look at it?

  6. #6
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,168

    Re: Return the value that falls within multiple ranges

    My results don't agree with your mocked up answers - I'm hoping it was a mistake on your end. Also, you don't say what to do if the values satisfy more than one Code. My answer shows all codes that match, extending additional codes to the cells to the right. Please try this in Cell G2 and copy down:

    =TRANSPOSE(FILTER($K$2:$K$22,(A2=$L$2:$L$22)*(B2=$M$2:$M$22)*(C2=$N$2:$N$22)*(D2>=$O$2:$O$22)*(D2<=$P$2:$P$22)*(E2>=$Q$2:$Q$22)*(E2<=$R$2:$R$22)*(F2>=$S$2:$S$22)*(F2<=$T$2:$T$22),"N/A"))

  7. #7
    Registered User
    Join Date
    07-05-2024
    Location
    NJ
    MS-Off Ver
    Microsoft 365, Spreadsheets
    Posts
    4

    Re: Return the value that falls within multiple ranges

    Thank you so much! It works like a dream on my Excel file!!!
    However, I'm trying to get the same results on Google Spreadsheets and it's giving me the error below, I looked this up and tried the formula below and is still giving me an error..
    Could you please help me with this too?
    "FILTER has mismatched range sizes. Expected row count: 21. column count: 1. Actual row count: 1, column count: 1."

    > =IFERROR(TRANSPOSE(FILTER($K$2:$K$22,(A5=$L$2:$L$22)*(B5=$M$2:$M$22)*(C5=$N$2:$N$22)*(D5>=$O$2:$O$22)*(D5<=$P$2:$P$22)*(E5>=$Q$2:$Q$22)*(E5<=$R$2:$R$22)*(F5>=$S$2:$S$22)*(F5<=$T$2:$T$22))),"N/A")

  8. #8
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,168

    Re: Return the value that falls within multiple ranges

    Sorry, don't know Google Sheets well. Glad it worked in Excel though.

  9. #9
    Registered User
    Join Date
    07-05-2024
    Location
    NJ
    MS-Off Ver
    Microsoft 365, Spreadsheets
    Posts
    4

    Re: Return the value that falls within multiple ranges

    Quote Originally Posted by Gregb11 View Post
    Sorry, don't know Google Sheets well. Glad it worked in Excel though.
    I figured out through the spreadsheet community, Thank you so much for your 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. Replies: 1
    Last Post: 02-01-2022, 07:29 AM
  2. [SOLVED] Determine if value falls between multiple ranges
    By T15K in forum Excel General
    Replies: 4
    Last Post: 01-20-2021, 03:25 AM
  3. [SOLVED] If statement falls between multiple date ranges
    By xrajncajnx in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-26-2019, 09:12 PM
  4. Replies: 3
    Last Post: 08-22-2014, 05:07 AM
  5. [SOLVED] Check if number falls in multiple ranges
    By T15K in forum Excel General
    Replies: 2
    Last Post: 05-29-2013, 08:05 PM
  6. [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
  7. Replies: 3
    Last Post: 05-06-2011, 07:14 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