+ Reply to Thread
Results 1 to 8 of 8

lookup if a number is within X of a range of numbers

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Omaha, NE
    MS-Off Ver
    MS 365
    Posts
    69

    lookup if a number is within X of a range of numbers

    Hello!

    Here's the data structure:
    Worksheet 1
    12512517
    9458273
    731282

    Worksheet 2
    712751752 foo
    847731 bar
    12512515 tee

    In worksheet 1, I want to put a formula in column B that does a lookup in worksheet 2 and return column B from worksheet 2 if the value in worksheet 1 column A is within 5 (plus or minus) of the value in worksheet 2 column A. In the example above, worksheet 1 A2 would be "tee".

    Thank you!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,133

    Re: lookup if a number is within X of a range of numbers

    Maybe something like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    08-23-2012
    Location
    Omaha, NE
    MS-Off Ver
    MS 365
    Posts
    69

    Re: lookup if a number is within X of a range of numbers

    This hit the mark exactly. Small requirement change. In addition to the original criteria, I'd like to know if Column C in worksheet 2 contains "scarf". If it does, return TRUE.

  4. #4
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,924

    Re: lookup if a number is within X of a range of numbers

    Please provide a sample workbook.
    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.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,133

    Re: lookup if a number is within X of a range of numbers

    You're welcome. Thanks for the rep.


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,210

    Re: lookup if a number is within X of a range of numbers

    Try this formula:

    =COUNTIFS(Sheet2!$A$1:$A$10,">="&A1-5,Sheet2!$A$1:$A$10,"<="&A1+5,Sheet2!$B$1:$B$10,"scarf")>0

  7. #7
    Registered User
    Join Date
    08-23-2012
    Location
    Omaha, NE
    MS-Off Ver
    MS 365
    Posts
    69

    Re: lookup if a number is within X of a range of numbers

    Thank you all for your help. I'm just having trouble wrapping my head around this one. For the uploaded data, I want to refusals!K:K to be populated with TRUE/FALSE if these conditions exists (AND):
    - refusals:epoch is within +5 seconds of agentlog:epoch (ignore values where agentlog:epoch is greater than refusals:epoch)
    - refusals:FullName = agentlog:Agent
    - agentlog:Action = "*Product Feedback | Salesforce*" (contains the string)




    example.xlsx

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2504
    Posts
    19,403

    Re: lookup if a number is within X of a range of numbers

    Try pasting the following into cell K2 on the refusals sheet and then copying down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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 value if a number lies between a range of numbers (multiple numbers)
    By excel_2023 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-26-2023, 02:49 AM
  2. Lookup the largest number in a range and return a number of other factors
    By JumpingJim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 04:07 AM
  3. [SOLVED] V/h lookup? Matching a number from a range then defining as another number
    By Leathermyth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-20-2013, 01:31 PM
  4. How to lookup a value from number between two numbers
    By Anastasis in forum Excel General
    Replies: 2
    Last Post: 04-04-2011, 05:01 AM
  5. Excel 2007 : Lookup of rounded number fails for certain numbers
    By wildwilly1111 in forum Excel General
    Replies: 2
    Last Post: 03-17-2011, 04:54 PM
  6. How lookup numbers between range numbers in 1 cell ?
    By termal in forum Excel General
    Replies: 4
    Last Post: 02-06-2010, 06:57 AM
  7. Text vs Number when using lookup table of numbers
    By fishsponge in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-02-2007, 10:06 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