Function myFunction(rng As Excel.Range)
stng = ""
bool = 0
For Each cell In rng
If cell <> "" Then
stng = cell
bool = bool + 1
End If
If bool = 1 Then
setOutput = stng
End If
If stng <> setOutput Then
myFunction = False
Exit Function
End If
Next cell
myFunction = True
End Function
=myFunction(A1:A10)
Function myFunction(rng As Excel.Range)
stng = ""
bool = 0
For Each cell In rng
cell = LCase(cell)
If cell <> "" Then
stng = cell
bool = bool + 1
End If
If bool = 1 Then
setOutput = stng
End If
If stng <> setOutput Then
myFunction = False
Exit Function
End If
Next cell
myFunction = True
End Function
See if this works for you,
=IF(SUMPRODUCT((A1:A10<>"")/COUNTIF(A1:A10,A1:A10&""))=1,"yes","no")
=IF(SUMPRODUCT((A1:A10<>"")/COUNTIF(A1:A10,A1:A10&""))=1,TRUE,FALSE)
If you're just going to return TRUE or FALSE, you can drop the IF entirely:
=SUMPRODUCT((A1:A10<>"")/COUNTIF(A1:A10,A1:A10&""))=1