Number of days off calculation

kaz123

New Member
Joined
Oct 8, 2017
Messages
31
Hello

I wanted help with calculating extra hour worked by employees and the resulting time off based on the month the hours were worked as it will be based on a different rules for some months.

I have the table/attachment below and wanted the time-off column populated as follows:

> If total hours worked by employees exceeds 16 hours then they get 2 days off regardless of when they worked those hours. (see John Smith)
> If total hours worked is less than 16 hours and they worked in Jan and Feb and/or April then the days off should be based on the latest rule (Feb March) - see Dev Patel
> if however, they done less then 16 hours and only worked extra hour in January then it will be based on Jan rule - see Steve Brown
> If they worked Feb and/or March, they get 1 day off if they worked 5 hours or more as the rule is different to Jan - see Abby Smith

Jan rule:
2hr to 5.5 hrs = 0.5 days
5.5hrs to 8hrs = 1 day
8hrs to 12hrs = 1.5 days
12hrs to 16hrs = 2 days


Feb and March rule
2hr to 5 hrs = 0.5 days
5hrs to 8hrs = 1 day
8hrs to 12hrs = 1.5 days
12hrs to 16hrs = 2 days

Thanks
 

Attachments

  • Screenshot 2021-10-07 at 12.47.32.png
    Screenshot 2021-10-07 at 12.47.32.png
    83 KB · Views: 11

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I would probably create 12 Vlookup tables (one for each month, even if some months are the same). Then use vLookup formula on each of the 12 tables...you can use the month abbreviation to label each lookup table, so 'Jan' is one table with it's own criteria, 'Feb' etc. then use the formula
Excel Formula:
=VLOOKUP(A2,INDIRECT(B2),2,1)
Vlookup Capture.JPG
 
Upvote 0
I would probably create 12 Vlookup tables (one for each month, even if some months are the same). Then use vLookup formula on each of the 12 tables...you can use the month abbreviation to label each lookup table, so 'Jan' is one table with it's own criteria, 'Feb' etc. then use the formula
Excel Formula:
=VLOOKUP(A2,INDIRECT(B2),2,1)
View attachment 48571
Hi, thanks for the response. I only two sets of rule as its same rule for Feb and March and there are only 3 months in total for my purpose. How could I get the data populated in column "Time off" based on your method?

*apologies - just seen your attachment - thanks, will have a look into your suggestion
 
Upvote 0
I would probably create 12 Vlookup tables (one for each month, even if some months are the same). Then use vLookup formula on each of the 12 tables...you can use the month abbreviation to label each lookup table, so 'Jan' is one table with it's own criteria, 'Feb' etc. then use the formula
Excel Formula:
=VLOOKUP(A2,INDIRECT(B2),2,1)
View attachment 48571
Hi, I still cannot get this to work and look like the how it appears in the attachment, the ExtraHrs in the look is hardcoded whereas what I have value between a range
 
Upvote 0
You can create 2 lookup tables: maybe call one STANDARD and the other NONSTD. Then you'll replace INDIRECT(B2) with the name of the proper table (either STANDARD or NONSTD. Range names make it easier to have the ABSOLUTE Range of cells....you could always use the cell references and make them ABSOLUTE references with the F4 key. So for the Standard lookup use =vlookup(a2, STANDARD, 2, 1) or =VLOOKUP(A2,$I$1:$J$5,2,TRUE)
 
Upvote 0
You can create 2 lookup tables: maybe call one STANDARD and the other NONSTD. Then you'll replace INDIRECT(B2) with the name of the proper table (either STANDARD or NONSTD. Range names make it easier to have the ABSOLUTE Range of cells....you could always use the cell references and make them ABSOLUTE references with the F4 key. So for the Standard lookup use =vlookup(a2, STANDARD, 2, 1) or =VLOOKUP(A2,$I$1:$J$5,2,TRUE)
Thanks for your advice, will look into this.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
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