Find Data that is closest to a value

K

kf2003

I need to be able to enter 2 values and search a database
table for the closest entry to the 2 vaules (separate
fields). The values in the databse are to 10 decimal
places. There are one million entries to search through -
but these can be grouped by another field that can be used
for a searchthat splits it into 46 groups.

All and any help appreciated
 
J

John Spencer (MVP)

An example of defining what is the closest?

Given
x-array 1,20,30
Y-array 5,6,40

What is the closest to x = 7 and y = 34?
Do you calculate that as the sum of the absolute difference between the two sets
of numbers?
1-7 >> 6, 5-34 >> 29 --->> 35
20-7 >> 13, 6-34 >> 28 --->> 41
30-7>> 23, 40-34 >>6 --->> 29 (this 30,40 pair is the "closest" to 7,34)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top