Thread: any ideas?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default any ideas?

There might be an Excel worksheet function, but this UDF will do it:

Function ValuesTooClose(rng As Range, lMinValue As Long) As Boolean

Dim i As Long
Dim n As Long
Dim UB As Long
Dim arr

arr = rng
UB = UBound(arr, 2)

For i = 1 To UB
For n = i To UB
If Abs(arr(1, i) - arr(1, n)) < lMinValue And i < n Then
ValuesTooClose = True
Exit Function
End If
Next n
Next i

End Function


Then do in the sheet: Insert, Function, User Defined etc.

RBS


"rosysnozzy" wrote in message
...
Hello clever Excel people,
I have tried various different formulas with no success. Basically I have
a
row of values, lets say: 10,45,12,28,30. I need formula that I can enter
into
conditional formatting so that if any of the values are less than 3 away
from
any of the other values (eg: 10 and 12 are too close, as are 28 and 30),
it
will turn a different colour to highlight the error. Please help, I have
exhausted all the Excel geeks at work including the IT department.
Thank you :-)