dunganbrendan
New Member
 Joined
 Aug 17, 2021
 Messages
 7
 Office Version

 2016
 Platform

 Windows
Good afternoon all.
We are trying to count and sum the monthly payroll for all employees #1,#2, etc. up to a certain count (in the example below, 7). Essentially, we need all the Boolean answers (see formula) to be in a sequence and then for an array formula to spit out a sum (and count, though this may seem redundant) of all the TRUE monthly payroll figures. (Note: The Employee column is redundant in this casethis is just to show a count.)
The Boolean Countif function displayed below takes the count from the first cell (absoluted) to the first cell (relative) and then from the first cell to each cell below it.
We are able to do this with helper columns, but they are making my template twice as heavy and will make it up to five times heavy if I create the template the way I want it. (The helper columns aren't only helper columns, but helper tables. And there would be perhaps ten unnecessary tables when the project is completed. Trying to keep it simple and at a reasonable size for customers.)
Limitations:
1. The data will always be formatted in a table.
2. The data is always sorted based on the hire date of the employee. This means there will be some gaps in the data (for example, we are summing the June payroll of the seven oldest employees and there was an old employee who retired in March of the same year). Because of this, Index/Match formulas are out of the picture. If there is a way to use Index/Match with this idea, I am open to it, but I would like to stay away from those formulas if possible.
3. Bonus/low priority: Because there are gaps in the data (example above), it would be ideal if we could combine two formulas, one asking for employees less than the criteria figure (again, 7 in our example below) and one asking for the figure that is not blank and is equal to the criteria.
4. Data from our customers can include up to a few thousand employees.
VBA code (with explanation please) would be very much appreciated as would any reference to online articles or other forums regarding countifs, array formulas, and anything related to the question at hand. Any help would be GREATLY appreciated. Thank you!!!!
(using Excel 2016)
We are trying to count and sum the monthly payroll for all employees #1,#2, etc. up to a certain count (in the example below, 7). Essentially, we need all the Boolean answers (see formula) to be in a sequence and then for an array formula to spit out a sum (and count, though this may seem redundant) of all the TRUE monthly payroll figures. (Note: The Employee column is redundant in this casethis is just to show a count.)
The Boolean Countif function displayed below takes the count from the first cell (absoluted) to the first cell (relative) and then from the first cell to each cell below it.
We are able to do this with helper columns, but they are making my template twice as heavy and will make it up to five times heavy if I create the template the way I want it. (The helper columns aren't only helper columns, but helper tables. And there would be perhaps ten unnecessary tables when the project is completed. Trying to keep it simple and at a reasonable size for customers.)
Limitations:
1. The data will always be formatted in a table.
2. The data is always sorted based on the hire date of the employee. This means there will be some gaps in the data (for example, we are summing the June payroll of the seven oldest employees and there was an old employee who retired in March of the same year). Because of this, Index/Match formulas are out of the picture. If there is a way to use Index/Match with this idea, I am open to it, but I would like to stay away from those formulas if possible.
3. Bonus/low priority: Because there are gaps in the data (example above), it would be ideal if we could combine two formulas, one asking for employees less than the criteria figure (again, 7 in our example below) and one asking for the figure that is not blank and is equal to the criteria.
4. Data from our customers can include up to a few thousand employees.
VBA code (with explanation please) would be very much appreciated as would any reference to online articles or other forums regarding countifs, array formulas, and anything related to the question at hand. Any help would be GREATLY appreciated. Thank you!!!!
(using Excel 2016)