'vba how do not count rows (or count only once) if they have the same parameter

I need to count rows in column "rating_status2" with value "unclear" and if they have the same "customer_nbr" only once. How it can be done? The structure of the data is following:

rating_status2   customer_nbr
unclear            1         
unclear            2
approved           3
approved           4
unclear            1
unclear            1
unclear            2

Here number of row with value "unclear" should be calculated as 2, because of the same "customer_nbr"

My code is below, but it only works for counting cells which are "unclear". How can I modified it? `

Function Unclear_Rating()
Dim i As Integer
Dim intCounter(1) As Integer
Dim intLastRow As Integer
Dim zelle2 As Range
Dim posMonitoring2 As Integer
Dim zelle3 As Range
Dim posMonitoring3 As Integer

With Sheets("ICS Analysis")
    
    Set zelle2 = .Cells.Find("rating_status2", lookat:=xlWhole)
    posMonitoring2 = zelle2.Column
    Set zelle3 = .Cells.Find("customer_nbr", lookat:=xlWhole)
    posMonitoring3 = zelle3.Column
    
   intLastRow = .UsedRange.Rows.Count

    For i = 2 To intLastRow

            If .Cells(i, posMonitoring2).Value = "unclear" Then
                intCounter(1) = intCounter(1) + 1
                             
            End If
    Next i
 
   Unclear_Rating = intCounter
    End With
End Function`


Solution 1:[1]

You can sort your data on rating_status2 and use subtotals (use the count function), like this you don't even need VBA.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dominique