×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Finding nearest value in a lookup table

Finding nearest value in a lookup table

Finding nearest value in a lookup table

(OP)
I have an Excel spreadsheet that calculates a series of resistor values from some test data.  The problem I have is that I want the spreadsheet to select the nearest available values of resistance from a table of preferred values, a common enough type of problem I would have thought.

Is there an Excel function that will do this or is it time I got to grips with Visual Basic?

Thank you
Peter

RE: Finding nearest value in a lookup table

try investigating the lookup examples at:

http://www.ozgrid.com/download/default.htm

perhaps ones of the many examples will meet your needs. pls advise of any needed information.

good luck!
-pmover

RE: Finding nearest value in a lookup table

Look through the help file on VLOOKUP and HLOOKUP.  There is an optional paramter that defines the type of match (exact, etc.).

RE: Finding nearest value in a lookup table

When you have a value between the available series of resistance, the default match type for LOOKUP and MATCH picks the lower value (list is sorted in ascending order). You can, as an option, select an exact match type (tabvle need not be sorted), or the next higher match (table sorted in descending order). When you need to strictly pick the closest match, that could be more involved - does anyone have a tip for that?

RE: Finding nearest value in a lookup table

you could lookup the next higher cell and look up the next lower cell and determine the one that has the lower absolute value of difference to your lookup target... use that information in an if function to access the data you want (may require index function to help lookup other stuff on the same row).

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

RE: Finding nearest value in a lookup table

(OP)
Well I have managed it with your combined help thanks, though it doesn't look too pretty (and I'm mentally a bit drained).

I've got two columns of preferred values, one ascending the other descending, and a MATCH function for each, then an IF statement to get the closest value.

As electricpete says (Pete, in cricket terms, you're an all-rounder!) I have to use an INDEX function with each MATCH function as the latter gives a cell reference rather than the actual value.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close