UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Rounding or finding closest matching number    
 
   
zekebar
post May 14 2006, 05:31 AM
Post #1

UtterAccess Addict
Posts: 123



I have a table with a list of results like this
A B
1.1 60
1.2 75
1.3 90
1.4 99

I am trying to take the number of a text box and to a dlookup of coumn B that is the closest match and give me the result of column A

Example:
the value I have is 82 I need it to find the closest value in colum B (75) and Return Column A (1.2)

Anyone might have a suggestion.


Thank You
Zeke Barlow
(IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+
Jerry Dennison
post May 14 2006, 07:52 AM
Post #2

Head Wizard
Posts: 14,857
From: South Carolina, USA



To find the nearest number you need only find the Min of the absolute value of the difference between the two numbers.

Min(ABS([B] - [ComparisonFieldName]))
Go to the top of the page
 
+
zekebar
post May 21 2006, 07:10 PM
Post #3

UtterAccess Addict
Posts: 123



I am not quite understanding here.

Here is my Control Source
=DLookUp("[GE]","GEConversion","[VO]= " & Min(Abs([GEConversion]![VO]-[VC])))

GE = The number I want
VO = The Column In the Table That I Comparing
VC = The name of the text box on the form that has the value I am trying to find the nearest value in the VO
Column
GEConversion = The name of the table I am looking in.

Example:
the value I have is [VC] "82" I need it to find the closest value in colum VO (75) and Return Column GE (1.2)

Do you have any suggestions on what I am doing wrong here.
It returns "Error"

Thank You
Zeke Barlow
(IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+
Jerry Dennison
post May 21 2006, 08:38 PM
Post #4

Head Wizard
Posts: 14,857
From: South Carolina, USA



You will need to use a query to return the values, not a domain aggregate function.
Go to the top of the page
 
+
zekebar
post May 21 2006, 11:22 PM
Post #5

UtterAccess Addict
Posts: 123



I am a little lost here.
Could you help me out here
Here is a copy of the database.

Zeke Barlow
(IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Attached File(s)
Attached File  Copy of Score Original.zip ( 177.95K ) Number of downloads: 3
 
Go to the top of the page
 
+
Jerry Dennison
post May 22 2006, 03:13 PM
Post #6

Head Wizard
Posts: 14,857
From: South Carolina, USA



Since I don't have a clue which tables you're trying to compare it will be impossible for me to offere anything. You need to re-examine your table structure. You have repeating groups and repeating entities. These should be resolved before moving forward. I strongly suspect that once you get your structure correct you will answer your own question on how to cross-reference related values.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 02:00 PM