Countif using match vba

Alpacino

Well-known Member
Joined
Mar 16, 2011
Messages
511
Hi I'm trying to count a total of holidays days for an employee
Each worksheet is set the same employees down A5:A49 with dates along the top. Each month for each sheet
I'm using vba match to find the row number for the employee
i = Range("a1").value 'employee list in data validation

x = Match(i, range("A5:A49"), 0)
z = countif(sheet1.Range("C" & x, "AK" & x), sheet13.range("O7").value)

Range("K3").value = z

How do I loop this for each month sheet1 to 12 adding up totals pf each month together.
E.g if sheet1 jan = 2
Sheet2 Feb = 4
Sheet6 July = 1
Sheet12 December = 2
The total "z" will be 9 in range("K3")

Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,561
Messages
6,179,521
Members
452,923
Latest member
JackiG

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