+ Reply to Thread
Results 1 to 6 of 6

Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup Value

  1. #1
    Registered User
    Join Date
    08-20-2021
    Location
    Denver, CO
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (16.0.14228.20216) 64-bit
    Posts
    11

    Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup Value

    Hi all,

    I am trying to make Excel return the position of the first value in a string of numbers that closely matches a lookup value. I am currently using MATCH(MIN(ABS())) to return the position of the closest value in the string, but this is not the ideal solution.

    I have attached a sample file. The values in the example subject string increase and then decrease (though they may behave differently in different scenarios outside of this example). I want it to return the closest value before it decreases. The formula I am using currently (D8) returns 16, while the goal would be to have it return 11 (specified in file).

    I'm hoping there is a way I can make it return the first value that is within, say, 5%, or within 10, of the subject value (D3).

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup V

    Hello.

    Depending on the criterion you use to get the goal value, maybe you could try:
    =MATCH(D3*1.02,D6:AD6,1)

    Good luck!

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup V

    Try

    =LET(a,MATCH(1,1/(D6:AD6>E6:AE6),0),b,D6:INDEX(D6:AD6,a),MATCH(MIN(ABS(b-D3)),ABS(b-D3),0))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    08-20-2021
    Location
    Denver, CO
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (16.0.14228.20216) 64-bit
    Posts
    11

    Re: Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup V

    kvsrinivasamurthy

    After porting this over to my file, this appears to be working, except for certain instances. Sometimes negative value(s) in the string of numbers seems to be throwing it off, or if the peak number in the string is too far off from the lookup value. This results in it throwing an #N/A or simply displaying the incorrect result.

    Can you explain briefly what the logic in this formula is? This formula is beyond my ability to interpret.

    Thank you

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup V

    Pl post a sample file showing problem.

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

    Re: Return Position of First Value Within X% Range of/Specific Margin of Error of Lookup V

    In the meantime try this in cell E8 and copy down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I get this:


    C
    D
    E
    8
    Return Position
    16
    16
    9
    11
    10
    Goal Value to Return
    11
    Dave

+ 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. Margin Calc to give a specific % of margin
    By king10001 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-16-2022, 12:05 PM
  2. [SOLVED] Return Row heading by Column header and specific texted cell row position
    By Amolvijay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2014, 01:39 AM
  3. Replies: 1
    Last Post: 07-11-2014, 02:36 PM
  4. Lookup date and return specific cell value from a range
    By Clash in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-31-2014, 09:25 AM
  5. [SOLVED] Lookup specific value in range of duplicates return if true
    By maddog9486 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-27-2013, 02:54 PM
  6. Return the row value / position within a range?
    By sproutingg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-01-2011, 11:41 AM
  7. Lookup function with a margin of error
    By SIFT-MS88 in forum Excel General
    Replies: 0
    Last Post: 06-16-2010, 01:27 PM

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