Countifs in Rows & Columns with Date Reference

raymhuber

New Member
Joined
May 16, 2014
Messages
17
Hi, I have a large workbook tracking the attendance of various employees. I need to count how many people have certain events, ie how many people were late in a month or how many people are ill.

I am getting an error whenever I use the following type of countifs, it has something to do with trying to use countifs in a whole table vs one row.

I put some sample data below (P = Present, S = Start, P = present, L = late). An example formula for determining how many people are late is Countifs(B2:F5,"L",B1:F1, ">=" & 1/1/18, B1:E1, "<" & 2/1/18) to count the number of times people were late in the month of January. This gives a #Value error, although if you only looked in one row, for instance B2:F2 it does not have an issue. Right now I am using an intermediary table to sum the number of each type per day, then sum each type by month, but I want to get it down to one formula. Does anyone know how you would go about doing this? Maybe some sort of array match formula?


Name1/1/181/2/181/3/181/4/18
BobPPPA-Ill
FredSPP
GeorgePPPP
AlanPLPL

<tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
In case anyone else has a similar question, I have figured out the answer and put it below.

Instead of using a Countifs statement, use a SUMPRODUCT. For this case, the syntax would be SUMPRODUCT((B2:F5 = "L") * (B1:F1 >= 1/1/18 ) * ( B1:E1 < 2/1/18)) where the dates are actual date code values. In my case, I have them referenced from another cell.
 
Upvote 0
Try

=Countifs(B2:F5,"L",B1:F1, ">=" & DATEVALUE("1/1/18"), B1:E1, "<" & DATEVALUE("2/1/18"))
 
Upvote 0
Hi Special-K99

The issue was not with the dates, whose were actual values, I only wrote them as text to make it more clear.

I belive the issue is a limitation of countifs since it is a 1 row by x column reference verse a x rows by x columns reference. I'm any case the sumproducts works great
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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