I am currently working on a UDF which returns and concatenates the headers if it is greater than and less than to a specific value. I’m not really good in Excel-Vba and what I got so far is this pathetic code which I couldn’t understand anymore. I would truly appreciate it if someone could help. Here's what i got so far:
Public Function greaterLessValue(Rng As Range, Rng2 As Range, greater, less)
Dim rngArr() As Variant
rngArr = Rng.value
For i = 1 To UBound(rngArr, 1)
For j = 1 To UBound(rngArr, 2)
If rngArr(i, j) = xVal Then
For k = 1 To UBound(rngArr, 2)
If rngArr(i, k) = Yval Then countRowAsso = countRowAsso + 1
Next k
End If
Next j
Next i
End Function
If the value is greater than or equal to 5 and less than and equal to 10 it should return the same example bellow which concatenates the Header containing the specific value in the same column: