I'm trying to create a function that will tell me if X numbers out of 4
are equal. Something like:
Function AnyXEqual(x As Integer, int1 As Integer, int2 As Integer, int3
As Integer, int4 As Integer) As Boolean
'[code]
End Function
So
AnyXEqual(3, 67, 50, 67, 98) = False
AnyXEqual(2, 67, 50, 67, 98) = True
AnyXEqual(4, 67, 50, 67, 67) = False
AnyXEqual(3, 67, 50, 67, 67) = True
AnyXEqual(2, 67, 50, 67, 67) = True
I thought about using a For i = 1 to x loop (or 2) to compare them, but
I think that would only work if x was 2 ... if x was 3 I would need a
nested loop, and if x was 4 I would need another nested loop.
Something tells me this is a perfect situation for a recursive
function, but my brain has trouble thinking on that level. Any ideas?
Thanks.
Bookmarks