Re: Calculate distance between two points (numbers) in a number line

Tech-Archive recommends: Fix windows errors by optimizing your registry





"Silvio" <Silvio@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:FD4D7C6F-8910-493C-9F32-DE2B74B37DB1@xxxxxxxxxxxxxxxx
Hello everyone, how can I calculate the distance between two points (numbers)
in a number line using a calculated field? For example: (Filed1 and Filed are
saved number in any combination of positive and negative numbers)

Filed1 = -10
Field2 = +15
Number distance = 25 (this is the correct result)

Example 2:
Filed1 = -10
Field2 = -5
Distance = 5 (this is the correct result)

Example 3:
Filed1 = -10
Field2 = 5
Distance = 15 (this is the correct result)

This is what I have done but it does not work with combination of negative
and positive numbers...

=(IIf(([Filed1]>[Filed2]),Abs([Filed1])-Abs([Filed2]),([Filed2]-[Filed1])))

Why not just do

=Abs([Filed1] - [Filed2])

(did you mean Field1 and Field2?)

Tom Lake

.



Relevant Pages