'Vba nested do while loops to create a matrix

I am trying to get the code to fill the matrix on the right with the sum values from the table on the left. The code is skipping the first iteration and only running one column.

Before before

After after

Sub CreatingMatrix()
    Cc = 15
    Cr = 6
    Pr = 6
    Sr = 6
    Mr = 6
    Mc = 15
    ii = 15
    i = 6

    Do While Cells(5, ii) <> ""
        ii = ii + 1
        T3C = Cells(5, Cc)
        T1C = Cells(Cr, 2)

        Do While Cells(i, 14) <> ""
            i = i + 1
            T3P = Cells(Pr, 14)
            T1P = Cells(Pr, 1)

            If (T3C = T1C) And (T3P = T1P) Then
                Rank = Cells(Sr, 5).Value
                Cells(Mr, Mc).Value = Rank
            End If
            Mr = Mr + 1
            Sr = Sr + 1
            Pr = Pr + 1
        Loop

        Mc = Mc + 1
        Cc = Cc + 1
        Cr = Cr + 1
    Loop

End Sub


Solution 1:[1]

3 loops, 3 counters but very inefficient.

Sub CreatingMatrix()

    Dim i As Long, x As Long, y As Long
    i = 6
    Do While Cells(i, "A") <> ""

        x = 15 ' O
        Do While Cells(5, x) <> ""
            y = 6
            Do While Cells(y, "N") <> ""
                If Cells(i, "A") = Cells(y, "N") And _
                    Cells(i, "B") = Cells(5, x) Then
                    Cells(y, x) = Cells(i, "E")
                    Exit Do
                End If
                y = y + 1
            Loop
            x = x + 1
        Loop
        i = i + 1
        
    Loop

End Sub

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 CDP1802