Absolute value

S

Sally Mae

I have a sub that checks if the contents of cells in two rows are the same.
The cells contain numbers that are paset from another program. If they are
not the same I want to see how big the absolute difference is between the two
cells. I do not know how to write the difference in absoulte terms, so I need
help with that. My code is:
If rng4.Offset(l, 0) <> 0 And rng3.Offset(l, 0) Then
dblLocalReturnDiff = rng4.Offset(l, 0) - rng3.Offset(l, 0)
If dblLocalReutrnDiff > errorMarginal Then...
It is on the last row that I am interesetd in using the absoulte value for
the difference. Please help me!
 
N

Norman Jones

Hi Sally,

Try:

dblLocalReturnDiff = Abs(Abs(rng4.Offset(l, 0)) _
- Abs(rng3.Offset(l,
0)))
 
S

Stefi

If ABS(dblLocalReturnDiff ) > errorMarginal Then...
!
Regards,
Stefi

„Sally Mae†ezt írta:
 
N

Norman Jones

Hi Sally.

Another interpretation of your question would be:

dblLocalReturnDiff = Abs(rng4.Offset(l, 0) - rng3.Offset(l, 0))


The first suggestion returns the absolute value of the difference of the
absolute cell values; the latter expression returns the absolute value of
the difference of cell values.
 

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

Similar Threads

Check difference 2
VBA Coding Help for Beginner 0
Next without for 1
create a loop so i don't have to keep retyping? 4
SelectionChange Question 2
Help with autofilter 1
Creating a total line 4
Compile error 10

Top