how much annual leave taken

Rogerisit

Board Regular
Joined
Oct 20, 2016
Messages
70
Office Version
  1. 2019
Hello!
I am trying to calculate how much annual leave "Bob" had during the week ending 6/1/2017. This sheet hasn't pasted so well, sorry. The "a" on the attendance sheet sits in A7. But I need to know for each entire week, and this formula needs to work for all employees. I'm stuck!! Thank you for any help

January 2017
Present AAnnual Leave SSick Leave UUnpaid Leave WWeekend worked
Sun 01Mon 02Tue 03Wed 04Thu 05Fri 06Sat 07Sun 08Mon 09Tue 10Wed 11Thu 12Fri 13Sat 14Sun 15Mon 16Tue 17Wed 18Thu 19Fri 20Sat 21Sun 22Mon 23Tue 24Wed 25Thu 26Fri 27Sat 28Sun 29Mon 30Tue 31
Bob ssApp
Jim
Frank
Arthur
Mary
Doris
Betty
Nancy
Charles
Annie

<colgroup><col span="2"><col span="31"></colgroup><tbody>
</tbody>

<colgroup><col span="2"><col span="31"></colgroup><tbody>
</tbody>
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I don't know exactly what your workbook looks like now, but you seem to be able to adapt the formulas. So given the layout from post #2, try this:

B6: =SUMPRODUCT(--($G$5:$AK$5<=$E$2),--($G$5:$AK$5>=$E$2-6),--ISNUMBER(SEARCH(B$3,$G6:$AK6)))-SUMPRODUCT(--($G$5:$AK$5<=$E$2),--($G$5:$AK$5>=$E$2-6),--ISNUMBER(SEARCH(B$3,$G6:$AK6)),--ISNUMBER(SEARCH("/",$G6:$AK6)))/2

The first part, in red, works much the same way as the original formula. But instead of using --($G6:$AK6=B$3), I use the SEARCH function instead. This will now find and count a plain "a" as well as a "a/p" or "p/a". (SUMPRODUCT doesn't recognize wildcards.)

The next part, in green (how Christmassy!), does the same thing, but it counts those with an "a" AND a "/", then divides by 2 to show half a day, and subtracts from the first SUMPRODUCT. This works for a, p, and any of the other letters if you want.

Let me know if you get this to work.


Edit:

Here's a more succinct version, but it requires that you confirm it with Control+Shift+Enter when you put it in the formula bar:

=SUMPRODUCT(--($G$5:$AK$5<=$E$2),--($G$5:$AK$5>=$E$2-6),--ISNUMBER(SEARCH(B$3,$G6:$AK6)),IF(ISNUMBER(SEARCH("/",$G6:$AK6)),0.5,1))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,878
Messages
6,122,062
Members
449,064
Latest member
scottdog129

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