Jump to content

Using the closest match during a lookup not the next highest or lowest


This topic is 3591 days old. Please don't post here. Open a new topic instead.

Recommended Posts

When i am doing a lookup how can use the closest match not the next higher or lower.

 

For example 

 

I have two fields:

 

1) Version

2) Service Pack

 

I run a lookup that takes the version number from one table and gets the match from the next table and copies the Service Pack.

 

In the case that there is no match i am forced to use either the next higher value or next lower value.

 

I want to choose the closest value be it higher or lower. How can i do that?

 

Thanks again!

 

-Erik

Link to comment
Share on other sites

I want to choose the closest value be it higher or lower. How can i do that?

 

Use a calculation field, not a lookup. Get both the next higher and next lower values, using the LookupNext() function, and select the one that's closer to the original value.

 

IIUC, you want to get the closest version number first - then use that to lookup (or just display) the Service Pack, using a second relationship based on the calculation field.

 

Edited by comment
Link to comment
Share on other sites

This topic is 3591 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.