Question

I looked through other questions and couldn't find what I needed.

Best if I explain as followed:

I have a spreadsheet that has three columns in it:

Product Name Vendor

Some vendors have the same product.

I need to count how many Product Names are identical by vendor.

All help is most appreciated.

Thank you,

user1114330

Example Data

Was it helpful?

Solution

Paste this formula in Cell C1

 =SUMPRODUCT(($A$1:$A$10=A1)*($B$1:$B$10=B1))

SNAPSHOT

enter image description here

However if you still want VBA, see this

Option Explicit

Sub Sample()
    Dim ws As Worksheet
    Dim lrow As Long

    Set ws = Sheets("Sheet1")

    With ws
        lrow = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("C1:C" & lrow).Formula = "=SUMPRODUCT(($A$1:$A$" & lrow & _
                                        "=A1)*($B$1:$B$" & lrow & "=B1))"
    End With
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top