Array formula to count data using macro

abcdabcd

New Member
Joined
May 15, 2012
Messages
2
Hi,

I want to match data from sheet1 with data in sheet2(Reporting matrix) using array formula in order to count the data. I used below macro that doesn't work. can any one help me to complet this. My thanks in advance!


Sub Count()
Dim Row As Integer, Col As Integer
Dim x As Integer
Dim y As Integer
Dim DD, TT, CID As Long
DD = Sheet1.Range("A2:A65536").End(xlUp)
TT = Sheet1.Range("C2:C65536").End(xlUp)
CID = Sheet1.Range("B2:B65536").End(xlUp)
x = 3
y = 2
For Col = 2 To 4
For Row = 3 To 6
ActiveSheet.Cells(Row, Col).FormulaArray = "=SUM((A1=Sheet1!DD)*(Sheet1!CID=Sheet2!A"&X&")*(Sheet2!B"&Y&"=Sheet1!TT))"
x = x + 1
y = y + 1
Next Row


Next Col


End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,216,307
Messages
6,129,992
Members
449,550
Latest member
LML2892

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top