=SUMPRODUCT(((LEFT(NRange,1)+0)=8)/COUNTIF(NRange,NRange&""))
A | B | C | D | |
1 | Numbers | Begin with | Count Unique | |
2 | 8404 | 8 | 7 | |
3 | 8404 | |||
4 | 8404 | |||
5 | 8449 | |||
6 | 8450 | |||
7 | 8522 | |||
8 | 8553 | |||
9 | 8553 | |||
10 | 8553 | |||
11 | 8558 | |||
12 | 8562 | |||
13 | 9404 | |||
14 | 9404 | |||
15 |
[table="width: 500"]
[tr]
[td]Function UniqueCount(Rng As Range, BeginWith As String) As Long
Dim V As Variant, Data As Variant
Data = Rng.Value
With CreateObject("Scripting.Dictionary")
For Each V In Data
If Left(V, Len(BeginWith)) = BeginWith Then .Item(V) = 1
Next
UniqueCount = .Count
End With
End Function[/td]
[/tr]
[/table]