Excel Formula to calculate threshold

gd6noob

Board Regular
Joined
Oct 20, 2017
Messages
170
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

Just had a query with trying to calculate some formula.

As you can see in the table below, I want to calculate the % of the employee that will be away to the total of headcount of each manager. So in J2 for Alice on Mar 1, there is 1 person that will be absent for 2 days. So if Today is Mar 1, J2 would be 2% of the headcount. the Max threshold for any Manger should not exceed 10%(indicated in J1). If today is Mar 3, that person will be back and Alice would be at 0%.

Book1
ABCDEFGHIJ
1NameManagerTime OffDate# of DaysManagerTotal Headcount10%
2AlanAliceVacation15-Mar10Alice50
3BobAliceSick01-Mar4Kate 40
4charlieAlicePersonal Day10-Mar2
5DebbieKate Vacation15-Mar5
6ErinKate Sick01-Mar1
7FrankKate Personal Day10-Mar1
Sheet1


I hope I've explained it clearly, if not, let me know.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I have changed some dates & Headcount - so it works with todays date - using today() , as all the dates where in future
I have also added a helper column "F" for the End data of the absence , using workday() - so only Mon-Fri - I'm sure we could use something without that helper - but it was quick
If its 7 days a week , then just add the number to the startdate

so to find out the number of people that are off as of this day
i used
=COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())

then wrapped that with the headcount to get a %
=COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())/I2

You could also add an IF
=IF((COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())/I2)>J$1,"Exceeds Target",COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())/I2)

Various.xlsx
ABCDEFGHIJKL
1NameManagerTime OffDate# of DaysEndManagerTotal Headcount0.1Count
2AlanAliceVacation2/16/22103/2/22Alice504%0
3BobAliceSick2/27/2243/3/22Kate 6Exceeds Target0
4charlieAlicePersonal Day3/10/2223/14/22
5DebbieKate Vacation2/26/2253/4/22TRUE3/2/222
6ErinKate Sick2/27/2212/28/22TRUE3
7FrankKate Personal Day2/10/22303/24/22FALSE0
8TRUE0
9TRUE0
10TRUE0
11FALSE0
Sheet17
Cell Formulas
RangeFormula
J2:J3J2=IF((COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())/I2)>J$1,"Exceeds Target",COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())/I2)
L2:L3L2=COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,">="&TODAY(),$F$2:$F$7,"<="&TODAY())
K5K5=WORKDAY(D2,E2)
D6D6=TODAY()
F2:F7F2=WORKDAY(D2,E2)
J5:J11J5=AND(TODAY()>=D2,TODAY()<=WORKDAY(D2,E2))
L5:L11L5=COUNTIFS($B$2:$B$7,H2,$D$2:$D$7,"<="&TODAY(),$F$2:$F$7,">="&TODAY())
 
Upvote 0
Solution
Hi @etaf, just a follow up question,

Using the table you provided, I would like to calculate the threshold for future state as well. e.g. the threshold on a weekly basis.
Im unable to come up with the formula myself, would you beable to provide some assistance?

Time Off Tracker.xlsb
NOP
14Week NumberTotal HC0.1
15175
16275
17375
18475
19575
20675
21775
22875
23975
241075
251175
261275
271375
281475
291575
301675
311775
321875
331975
342075
352175
362275
372375
382475
392575
402675
412775
422875
432975
443075
453175
463275
473375
483475
493575
503675
513775
523875
533975
544075
554175
564275
574375
584475
594575
604675
614775
624875
634975
645075
655175
665275
675375
2022
 
Upvote 0
it maybe worth starting a new question , so other members can also help, as the data will need to be broken down into weeknumbers
for instance the 10working days will cross a number of weeknumbers

i'm not sure the best way to break that info down
for example
15th march for 10days - is over 3 weeknumbers
4 day - week12
5 days - week13
1 days - week14

and so crosses 3 of you weeks
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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